linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Baolin Wang <baolin.wang@linux.alibaba.com>
To: Daniel Gomez <da.gomez@samsung.com>
Cc: "akpm@linux-foundation.org" <akpm@linux-foundation.org>,
	"hughd@google.com" <hughd@google.com>,
	"willy@infradead.org" <willy@infradead.org>,
	"david@redhat.com" <david@redhat.com>,
	"wangkefeng.wang@huawei.com" <wangkefeng.wang@huawei.com>,
	"chrisl@kernel.org" <chrisl@kernel.org>,
	"ying.huang@intel.com" <ying.huang@intel.com>,
	"21cnbao@gmail.com" <21cnbao@gmail.com>,
	"ryan.roberts@arm.com" <ryan.roberts@arm.com>,
	"shy828301@gmail.com" <shy828301@gmail.com>,
	"ziy@nvidia.com" <ziy@nvidia.com>,
	"ioworker0@gmail.com" <ioworker0@gmail.com>,
	Pankaj Raghav <p.raghav@samsung.com>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 4/7] mm: shmem: extend shmem_partial_swap_usage() to support large folio swap
Date: Tue, 11 Jun 2024 10:59:27 +0800	[thread overview]
Message-ID: <7c834335-9872-4de3-9e53-179356826c93@linux.alibaba.com> (raw)
In-Reply-To: <qlk2dpg2fmro5vzjks45ciwt3qk6nzlurfmlqnjr4ecskgg7ln@w5ba55tgtcsb>



On 2024/6/10 22:53, Daniel Gomez wrote:
> Hi Baolin,
> On Thu, Jun 06, 2024 at 07:58:54PM +0800, Baolin Wang wrote:
>> To support shmem large folio swapout in the following patches, using
>> xa_get_order() to get the order of the swap entry to calculate the swap
>> usage of shmem.
>>
>> Signed-off-by: Baolin Wang <baolin.wang@linux.alibaba.com>
>> ---
>>   mm/shmem.c | 7 +++++--
>>   1 file changed, 5 insertions(+), 2 deletions(-)
>>
>> diff --git a/mm/shmem.c b/mm/shmem.c
>> index eefdf5c61c04..0ac71580decb 100644
>> --- a/mm/shmem.c
>> +++ b/mm/shmem.c
>> @@ -865,13 +865,16 @@ unsigned long shmem_partial_swap_usage(struct address_space *mapping,
>>   	struct page *page;
>>   	unsigned long swapped = 0;
>>   	unsigned long max = end - 1;
>> +	int order;
>>   
>>   	rcu_read_lock();
>>   	xas_for_each(&xas, page, max) {
>>   		if (xas_retry(&xas, page))
>>   			continue;
>> -		if (xa_is_value(page))
>> -			swapped++;
>> +		if (xa_is_value(page)) {
>> +			order = xa_get_order(xas.xa, xas.xa_index);
>> +			swapped += 1 << order;
> 
> I'd get rid of order and simply do:
> 
> 	swapped += 1UL << xa_get_order()

OK. Will do.


  reply	other threads:[~2024-06-11  2:59 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-06 11:58 [PATCH 0/7] support large folio swap-out and swap-in for shmem Baolin Wang
2024-06-06 11:58 ` [PATCH 1/7] mm: vmscan: add validation before spliting shmem large folio Baolin Wang
2024-06-06 11:58 ` [PATCH 2/7] mm: swap: extend swap_shmem_alloc() to support batch SWAP_MAP_SHMEM flag setting Baolin Wang
2024-06-06 11:58 ` [PATCH 3/7] mm: shmem: support large folio allocation for shmem_replace_folio() Baolin Wang
2024-06-06 11:58 ` [PATCH 4/7] mm: shmem: extend shmem_partial_swap_usage() to support large folio swap Baolin Wang
     [not found]   ` <CGME20240610145327eucas1p1bb32a985f8eaddf8cdda0b5415c1868c@eucas1p1.samsung.com>
2024-06-10 14:53     ` Daniel Gomez
2024-06-11  2:59       ` Baolin Wang [this message]
2024-06-06 11:58 ` [PATCH 6/7] mm: shmem: use swap_free_nr() to free shmem swap entries Baolin Wang
2024-06-06 11:58 ` [PATCH 7/7] mm: shmem: support large folio swap out Baolin Wang
     [not found] ` <5304c4c54868336985b396d2c46132c2e0cdf803.1717673614.git.baolin.wang@linux.alibaba.com>
     [not found]   ` <CGME20240610152307eucas1p10417f113fcc5e1729bdf638f370d54e4@eucas1p1.samsung.com>
2024-06-10 15:23     ` [PATCH 5/7] mm: add new 'orders' parameter for find_get_entries() and find_lock_entries() Daniel Gomez
2024-06-11  3:31       ` Baolin Wang
2024-06-10 16:59   ` Matthew Wilcox
2024-06-11  3:38     ` Baolin Wang
2024-06-12  5:46 ` [PATCH 0/7] support large folio swap-out and swap-in for shmem Hugh Dickins
2024-06-12  6:23   ` Baolin Wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7c834335-9872-4de3-9e53-179356826c93@linux.alibaba.com \
    --to=baolin.wang@linux.alibaba.com \
    --cc=21cnbao@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=chrisl@kernel.org \
    --cc=da.gomez@samsung.com \
    --cc=david@redhat.com \
    --cc=hughd@google.com \
    --cc=ioworker0@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=p.raghav@samsung.com \
    --cc=ryan.roberts@arm.com \
    --cc=shy828301@gmail.com \
    --cc=wangkefeng.wang@huawei.com \
    --cc=willy@infradead.org \
    --cc=ying.huang@intel.com \
    --cc=ziy@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox