[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87sf4yaajv.fsf@yhuang6-desk2.ccr.corp.intel.com>
Date:   Wed, 22 Nov 2023 08:36:36 +0800
From:   "Huang, Ying" <ying.huang@...el.com>
To:     Kairui Song <ryncsn@...il.com>
Cc:     linux-mm@...ck.org, Kairui Song <kasong@...cent.com>,
        Andrew Morton <akpm@...ux-foundation.org>,
        David Hildenbrand <david@...hat.com>,
        Hugh Dickins <hughd@...gle.com>,
        Johannes Weiner <hannes@...xchg.org>,
        Matthew Wilcox <willy@...radead.org>,
        Michal Hocko <mhocko@...e.com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 16/24] mm/swap: reduce scope of get_swap_device in
 swapin path
Kairui Song <ryncsn@...il.com> writes:
> From: Kairui Song <kasong@...cent.com>
>
> Move get_swap_device into swapin_readahead, simplify the code
> and prepare for follow up commits.
No.  Please don't do this.  Please check the get/put_swap_device() usage
rule in the comments of get_swap_device().
"
 * When we get a swap entry, if there aren't some other ways to
 * prevent swapoff, such as the folio in swap cache is locked, page
 * table lock is held, etc., the swap entry may become invalid because
 * of swapoff.  Then, we need to enclose all swap related functions
 * with get_swap_device() and put_swap_device(), unless the swap
 * functions call get/put_swap_device() by themselves.
"
This is to simplify the reasoning about swapoff and swap entry.
Why does it bother you?
> For the later part in do_swap_page, using swp_swap_info directly is fine
> since in that context, the swap device is pinned by swapcache reference.
[snip]
--
Best Regards,
Huang, Ying
Powered by blists - more mailing lists