Re: [PATCH for v5.8 3/3] mm/memory: fix IO cost for anonymous page

From: Vlastimil Babka
Date: Mon Jun 29 2020 - 17:30:03 EST


On 6/16/20 8:16 AM, js1304@xxxxxxxxx wrote:
> From: Joonsoo Kim <iamjoonsoo.kim@xxxxxxx>
>
> 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.
>
> Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@xxxxxxx>

Acked-by: Vlastimil Babka <vbabka@xxxxxxx>

> ---
> mm/memory.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/mm/memory.c b/mm/memory.c
> index bc6a471..3359057 100644
> --- a/mm/memory.c
> +++ b/mm/memory.c
> @@ -3143,6 +3143,14 @@ vm_fault_t do_swap_page(struct vm_fault *vmf)
> if (err)
> 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);
> }
>