[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <874j7zfqkk.fsf@yhuang6-desk2.ccr.corp.intel.com>
Date: Mon, 05 Aug 2024 14:10:03 +0800
From: "Huang, Ying" <ying.huang@...el.com>
To: Matthew Wilcox <willy@...radead.org>, Christoph Hellwig <hch@...radead.org>
Cc: Barry Song <21cnbao@...il.com>, akpm@...ux-foundation.org,
linux-mm@...ck.org, baolin.wang@...ux.alibaba.com, chrisl@...nel.org,
david@...hat.com, hannes@...xchg.org, hughd@...gle.com,
kaleshsingh@...gle.com, kasong@...cent.com,
linux-kernel@...r.kernel.org, mhocko@...e.com, minchan@...nel.org,
nphamcs@...il.com, ryan.roberts@....com, senozhatsky@...omium.org,
shakeel.butt@...ux.dev, shy828301@...il.com, surenb@...gle.com,
v-songbaohua@...o.com, xiang@...nel.org, yosryahmed@...gle.com
Subject: Re: [PATCH v5 4/4] mm: Introduce per-thpsize swapin control policy
Matthew Wilcox <willy@...radead.org> writes:
> On Fri, Jul 26, 2024 at 09:46:18PM +1200, Barry Song wrote:
>> A user space interface can be implemented to select different swap-in
>> order policies, similar to the mTHP allocation order policy. We need
>> a distinct policy because the performance characteristics of memory
>> allocation differ significantly from those of swap-in. For example,
>> SSD read speeds can be much slower than memory allocation. With
>> policy selection, I believe we can implement mTHP swap-in for
>> non-SWAP_SYNCHRONOUS scenarios as well. However, users need to understand
>> the implications of their choices. I think that it's better to start
>> with at least always never. I believe that we will add auto in the
>> future to tune automatically, which can be used as default finally.
>
> I strongly disagree. Use the same sysctl as the other anonymous memory
> allocations.
I still believe we have some reasons for this tunable.
1. As Ryan pointed out in [1], swap-in with large mTHP orders may cause
long latency, which some users might want to avoid.
[1] https://lore.kernel.org/lkml/f0c7f061-6284-4fe5-8cbf-93281070895b@arm.com/
2. We have readahead information available for swap-in, which is
unavailable for anonymous page allocation. This enables us to build
an automatic swap-in order policy similar to that for page cache
order based on readahead.
3. Swap-out/swap-in cycles present an opportunity to identify hot pages.
In many use cases, we can utilize mTHP for hot pages and order-0 page
for cold pages, especially under memory pressure. When an mTHP has
been swapped out, it indicates that it could be a cold page.
Converting it to order-0 pages might be a beneficial policy.
--
Best Regards,
Huang, Ying
Powered by blists - more mailing lists