linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Miaohe Lin <linmiaohe@huawei.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: <akpm@linux-foundation.org>, <ziy@nvidia.com>,
	<william.kucharski@oracle.com>, <yang.shi@linux.alibaba.com>,
	<aneesh.kumar@linux.ibm.com>, <rcampbell@nvidia.com>,
	<songliubraving@fb.com>, <kirill.shutemov@linux.intel.com>,
	<riel@surriel.com>, <hannes@cmpxchg.org>, <minchan@kernel.org>,
	<hughd@google.com>, <adobriyan@gmail.com>,
	<linux-kernel@vger.kernel.org>, <linux-mm@kvack.org>,
	<linux-fsdevel@vger.kernel.org>
Subject: Re: [PATCH v3 2/5] mm/huge_memory.c: use page->deferred_list
Date: Wed, 12 May 2021 10:02:16 +0800	[thread overview]
Message-ID: <b2b1f4e6-bc37-160b-5931-f64730d5ef53@huawei.com> (raw)
In-Reply-To: <YJsNRtg5IcMY7V/F@casper.infradead.org>

On 2021/5/12 7:03, Matthew Wilcox wrote:
> On Tue, May 11, 2021 at 09:48:54PM +0800, Miaohe Lin wrote:
>> Now that we can represent the location of ->deferred_list instead of
>> ->mapping + ->index, make use of it to improve readability.
>>
>> Reviewed-by: Yang Shi <shy828301@gmail.com>
>> Reviewed-by: David Hildenbrand <david@redhat.com>
>> Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
>> ---
>>  mm/huge_memory.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/mm/huge_memory.c b/mm/huge_memory.c
>> index 63ed6b25deaa..76ca1eb2a223 100644
>> --- a/mm/huge_memory.c
>> +++ b/mm/huge_memory.c
>> @@ -2868,7 +2868,7 @@ static unsigned long deferred_split_scan(struct shrinker *shrink,
>>  	spin_lock_irqsave(&ds_queue->split_queue_lock, flags);
>>  	/* Take pin on all head pages to avoid freeing them under us */
>>  	list_for_each_safe(pos, next, &ds_queue->split_queue) {
>> -		page = list_entry((void *)pos, struct page, mapping);
>> +		page = list_entry((void *)pos, struct page, deferred_list);
>>  		page = compound_head(page);
> 
> This is an equivalent transformation, but it doesn't really go far
> enough.  I think you want something like this:
> 
> 	struct page *page, *next;
> 
> 	list_for_each_entry_safe(page, next, &ds_queue->split_queue,
> 							deferred_list) {
> 		struct page *head = page - 1;
> 		... then use head throughout ...
> 	}
> 

Many thanks for your time and reminder. list_for_each_entry_safe is equivalent
to list_for_each_safe + list_entry and there is many places using list_for_each_safe
+ list_entry, so I think it's ok to keep the code as it is.
Thanks again. :)

> .
> 


  reply	other threads:[~2021-05-12  2:02 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-11 13:48 [PATCH v3 0/5] Cleanup and fixup for huge_memory Miaohe Lin
2021-05-11 13:48 ` [PATCH v3 1/5] mm/huge_memory.c: remove dedicated macro HPAGE_CACHE_INDEX_MASK Miaohe Lin
2021-05-11 13:48 ` [PATCH v3 2/5] mm/huge_memory.c: use page->deferred_list Miaohe Lin
2021-05-11 23:03   ` Matthew Wilcox
2021-05-12  2:02     ` Miaohe Lin [this message]
2021-05-11 13:48 ` [PATCH v3 3/5] mm/huge_memory.c: add missing read-only THP checking in transparent_hugepage_enabled() Miaohe Lin
2021-05-13 21:30   ` Yang Shi
2021-05-14  1:53     ` Miaohe Lin
2021-05-11 13:48 ` [PATCH v3 4/5] mm/huge_memory.c: remove unnecessary tlb_remove_page_size() for huge zero pmd Miaohe Lin
2021-05-11 13:48 ` [PATCH v3 5/5] mm/huge_memory.c: don't discard hugepage if other processes are mapping it Miaohe Lin

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=b2b1f4e6-bc37-160b-5931-f64730d5ef53@huawei.com \
    --to=linmiaohe@huawei.com \
    --cc=adobriyan@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=aneesh.kumar@linux.ibm.com \
    --cc=hannes@cmpxchg.org \
    --cc=hughd@google.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=minchan@kernel.org \
    --cc=rcampbell@nvidia.com \
    --cc=riel@surriel.com \
    --cc=songliubraving@fb.com \
    --cc=william.kucharski@oracle.com \
    --cc=willy@infradead.org \
    --cc=yang.shi@linux.alibaba.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;
as well as URLs for NNTP newsgroup(s).