All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kefeng Wang <wangkefeng.wang@huawei.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	<linux-kernel@vger.kernel.org>, <linux-mm@kvack.org>,
	David Hildenbrand <david@redhat.com>,
	<linux-s390@vger.kernel.org>
Subject: Re: [PATCH v2 06/10] mm: memory: use a folio in zap_pte_range()
Date: Mon, 6 Nov 2023 10:30:59 +0800	[thread overview]
Message-ID: <e3c275c3-e09d-4495-8132-9464133db283@huawei.com> (raw)
In-Reply-To: <ZUZ9dg4YHZdUKDqO@casper.infradead.org>



On 2023/11/5 1:20, Matthew Wilcox wrote:
> On Sat, Nov 04, 2023 at 11:55:18AM +0800, Kefeng Wang wrote:
>> -/* Decides whether we should zap this page with the page pointer specified */
>> -static inline bool should_zap_page(struct zap_details *details, struct page *page)
>> +/* Decides whether we should zap this folio with the folio pointer specified */
>> +static inline bool should_zap_page(struct zap_details *details, struct folio *folio)
> 
> Surely we should rename this to should_zap_folio()?
Will update.
> 
>> @@ -1487,10 +1492,10 @@ static unsigned long zap_pte_range(struct mmu_gather *tlb,
>>   			 * see zap_install_uffd_wp_if_needed().
>>   			 */
>>   			WARN_ON_ONCE(!vma_is_anonymous(vma));
>> -			rss[mm_counter(page)]--;
>> +			rss[mm_counter(&folio->page)]--;
>>   			if (is_device_private_entry(entry))
>> -				page_remove_rmap(page, vma, false);
>> -			put_page(page);
>> +				page_remove_rmap(&folio->page, vma, false);
>> +			folio_put(folio);
> 
> This is wrong.  If we have a PTE-mapped THP, you'll remove the head page
> N times instead of removing each of N pages.

This is device private entry, I suppose that it won't be a THP and large 
folio when check migrate_vma_check_page() and migrate_vma_insert_page(),
right?

> 
> I suspect you're going to collide with Ryan's work by doing this ...
> 
Maybe not if the above is true, at least for now.

Thanks.



  reply	other threads:[~2023-11-06  2:31 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-04  3:55 [PATCH rfc v2 00/10] mm: convert mm counter to take a folio Kefeng Wang
2023-11-04  3:55 ` [PATCH v2 01/10] mm: swap: introduce pfn_swap_entry_to_folio() Kefeng Wang
2023-11-04  3:55 ` [PATCH v2 02/10] s390: pgtable: use a folio in ptep_zap_swap_entry() Kefeng Wang
2023-11-04  3:55 ` [PATCH v2 03/10] mm: huge_memory: use a folio in __split_huge_pmd_locked() Kefeng Wang
2023-11-04  3:55 ` [PATCH v2 04/10] mm: huge_memory: use a folio in zap_huge_pmd() Kefeng Wang
2023-11-04  3:55 ` [PATCH v2 05/10] mm: memory: use a folio in copy_nonpresent_pte() Kefeng Wang
2023-11-04  3:55 ` [PATCH v2 06/10] mm: memory: use a folio in zap_pte_range() Kefeng Wang
2023-11-04 17:20   ` Matthew Wilcox
2023-11-06  2:30     ` Kefeng Wang [this message]
2023-11-06 14:20       ` Matthew Wilcox
2023-11-06 15:08         ` Kefeng Wang
2023-11-04  3:55 ` [PATCH v2 07/10] mm: memory: use a folio in do_set_pmd() Kefeng Wang
2023-11-04  3:55 ` [PATCH v2 08/10] mm: memory: use a folio in insert_page_into_pte_locked() Kefeng Wang
2023-11-04  3:55 ` [PATCH v2 09/10] mm: convert mm_counter() to take a folio Kefeng Wang
2023-11-04  3:55 ` [PATCH v2 10/10] mm: convert mm_counter_file() " Kefeng 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=e3c275c3-e09d-4495-8132-9464133db283@huawei.com \
    --to=wangkefeng.wang@huawei.com \
    --cc=akpm@linux-foundation.org \
    --cc=david@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=willy@infradead.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.