linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Kefeng Wang <wangkefeng.wang@huawei.com>
To: David Hildenbrand <david@redhat.com>,
	Andrew Morton <akpm@linux-foundation.org>
Cc: Helge Deller <deller@gmx.de>, Daniel Vetter <daniel@ffwll.ch>,
	Matthew Wilcox <willy@infradead.org>, <linux-mm@kvack.org>,
	Jonathan Corbet <corbet@lwn.net>
Subject: Re: [PATCH 1/4] fs/proc/task_mmu: use folio API in pte_is_pinned()
Date: Tue, 4 Jun 2024 22:26:54 +0800	[thread overview]
Message-ID: <5ec7f8b0-777c-44d2-874f-9332432129b4@huawei.com> (raw)
In-Reply-To: <70ce5e9a-ddd7-4e21-9ca9-cd0e72e1df60@redhat.com>



On 2024/6/4 19:51, David Hildenbrand wrote:
> On 04.06.24 13:48, Kefeng Wang wrote:
>> Convert to use vm_normal_folio() and folio_maybe_dma_pinned() API,
>> which helps to remove page_maybe_dma_pinned() in the subsequent change.
>>
>> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
>> ---
>>   fs/proc/task_mmu.c | 8 ++++----
>>   1 file changed, 4 insertions(+), 4 deletions(-)
>>
>> diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
>> index f8d35f993fe5..5aceb3db7565 100644
>> --- a/fs/proc/task_mmu.c
>> +++ b/fs/proc/task_mmu.c
>> @@ -1088,7 +1088,7 @@ struct clear_refs_private {
>>   static inline bool pte_is_pinned(struct vm_area_struct *vma, 
>> unsigned long addr, pte_t pte)
>>   {
>> -    struct page *page;
>> +    struct folio *folio;
>>       if (!pte_write(pte))
>>           return false;
>> @@ -1096,10 +1096,10 @@ static inline bool pte_is_pinned(struct 
>> vm_area_struct *vma, unsigned long addr,
>>           return false;
>>       if (likely(!test_bit(MMF_HAS_PINNED, &vma->vm_mm->flags)))
>>           return false;
>> -    page = vm_normal_page(vma, addr, pte);
>> -    if (!page)
>> +    folio = vm_normal_folio(vma, addr, pte);
>> +    if (!folio)
>>           return false;
>> -    return page_maybe_dma_pinned(page);
>> +    return folio_maybe_dma_pinned(folio);
>>   }
>>   static inline void clear_soft_dirty(struct vm_area_struct *vma,
> 
> Likely we should just get rid of the pte_is_pinned() check completely 
> now. We don't perform the same for PMDs, we don't sync against GUP-fast, 

Yes, no handle for clear PMDs.

> and the original COW vs. GUP issue was resolved.

Agree, but I'm not sure about removing it, from the commit 9348b73c2e1bf,

   "The whole "track page soft dirty" state doesn't work with pinned pages
   anyway, since the page might be dirtied by the pinning entity without
   ever being noticed in the page tables."

The issue is between the pin mechanism and "track page soft dirty", if
the page is pinned, the pining entiry(DMA?) could change the page but
the pte dirty won't be set, so maybe we still need it, even add some 
similar thing for PMD? Correct me if I'm wrong, thanks.



  reply	other threads:[~2024-06-04 14:27 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-04 11:48 [PATCH 0/4] mm: remove page_maybe_dma_pinned() and page_mkclean() Kefeng Wang
2024-06-04 11:48 ` [PATCH 1/4] fs/proc/task_mmu: use folio API in pte_is_pinned() Kefeng Wang
2024-06-04 11:51   ` David Hildenbrand
2024-06-04 14:26     ` Kefeng Wang [this message]
     [not found]       ` <f466aae2-9a3e-4081-b2d8-fa5930b8bc29@redhat.com>
2024-06-05  1:30         ` Kefeng Wang
2024-06-25 22:38           ` Andrew Morton
2024-06-26  4:57             ` David Hildenbrand
2024-06-04 11:48 ` [PATCH 2/4] mm: remove page_maybe_dma_pinned() Kefeng Wang
2024-06-04 11:48 ` [PATCH 3/4] fb_defio: use a folio in fb_deferred_io_work() Kefeng Wang
2024-06-04 11:53   ` David Hildenbrand
2024-06-04 11:48 ` [PATCH 4/4] mm: remove page_mkclean() Kefeng Wang
2024-06-07  6:46   ` [PATCH] pin_user_pages: fix underline length 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=5ec7f8b0-777c-44d2-874f-9332432129b4@huawei.com \
    --to=wangkefeng.wang@huawei.com \
    --cc=akpm@linux-foundation.org \
    --cc=corbet@lwn.net \
    --cc=daniel@ffwll.ch \
    --cc=david@redhat.com \
    --cc=deller@gmx.de \
    --cc=linux-mm@kvack.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox