Skip to content

Commit

Permalink
mm/memory: fix IO cost for anonymous page
Browse files Browse the repository at this point in the history
With synchronous IO swap device, swap-in is directly handled in fault
code.  Since IO cost notation isn't added there, with synchronous IO
swap device, LRU balancing could be wrongly biased.  Fix it to count it
in fault code.

Link: http://lkml.kernel.org/r/[email protected]
Fixes: 314b57f ("mm: balance LRU lists based on relative thrashing cache sizing")
Signed-off-by: Joonsoo Kim <[email protected]>
Acked-by: Johannes Weiner <[email protected]>
Cc: Joonsoo Kim <[email protected]>
Cc: Michal Hocko <[email protected]>
Cc: Minchan Kim <[email protected]>
Cc: Rik van Riel <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
JoonsooKim authored and torvalds committed Jun 26, 2020
1 parent cb68688 commit 0076f02
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions mm/memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -3146,6 +3146,14 @@ vm_fault_t do_swap_page(struct vm_fault *vmf)
goto out_page;
}

/*
* XXX: Move to lru_cache_add() when it
* supports new vs putback
*/
spin_lock_irq(&page_pgdat(page)->lru_lock);
lru_note_cost_page(page);
spin_unlock_irq(&page_pgdat(page)->lru_lock);

lru_cache_add(page);
swap_readpage(page, true);
}
Expand Down

0 comments on commit 0076f02

Please sign in to comment.