From: Kefeng Wang <wangkefeng.wang@huawei.com>
To: Zi Yan <ziy@nvidia.com>, David Hildenbrand <david@redhat.com>,
Andrew Morton <akpm@linux-foundation.org>
Cc: Baolin Wang <baolin.wang@linux.alibaba.com>, <linux-mm@kvack.org>,
"Huang, Ying" <ying.huang@intel.com>,
<linux-kernel@vger.kernel.org>, <stable@vger.kernel.org>
Subject: Re: [PATCH 1/2] mm/numa: no task_numa_fault() call if page table is changed
Date: Thu, 8 Aug 2024 22:36:59 +0800 [thread overview]
Message-ID: <b0b94a65-51f1-459e-879f-696baba85399@huawei.com> (raw)
In-Reply-To: <8890DD6A-126A-406D-8AB9-97CF5A1F4DA4@nvidia.com>
On 2024/8/8 22:21, Zi Yan wrote:
> On 8 Aug 2024, at 10:14, David Hildenbrand wrote:
>
>> On 08.08.24 16:13, Zi Yan wrote:
>>> On 8 Aug 2024, at 4:22, David Hildenbrand wrote:
>>>
>>>> On 08.08.24 05:19, Baolin Wang wrote:
>>>>>
>>>>>
...
>>>> Agreed, maybe we should simply handle that right away and replace the "goto out;" users by "return 0;".
>>>>
>>>> Then, just copy the 3 LOC.
>>>>
>>>> For mm/memory.c that would be:
>>>>
>>>> diff --git a/mm/memory.c b/mm/memory.c
>>>> index 67496dc5064f..410ba50ca746 100644
>>>> --- a/mm/memory.c
>>>> +++ b/mm/memory.c
>>>> @@ -5461,7 +5461,7 @@ static vm_fault_t do_numa_page(struct vm_fault *vmf)
>>>> if (unlikely(!pte_same(old_pte, vmf->orig_pte))) {
>>>> pte_unmap_unlock(vmf->pte, vmf->ptl);
>>>> - goto out;
>>>> + return 0;
>>>> }
>>>> pte = pte_modify(old_pte, vma->vm_page_prot);
>>>> @@ -5528,15 +5528,14 @@ static vm_fault_t do_numa_page(struct vm_fault *vmf)
>>>> vmf->pte = pte_offset_map_lock(vma->vm_mm, vmf->pmd,
>>>> vmf->address, &vmf->ptl);
>>>> if (unlikely(!vmf->pte))
>>>> - goto out;
>>>> + return 0;
>>>> if (unlikely(!pte_same(ptep_get(vmf->pte), vmf->orig_pte))) {
>>>> pte_unmap_unlock(vmf->pte, vmf->ptl);
>>>> - goto out;
>>>> + return 0;
>>>> }
>>>> goto out_map;
>>>> }
>>>> -out:
>>>> if (nid != NUMA_NO_NODE)
>>>> task_numa_fault(last_cpupid, nid, nr_pages, flags);
>>>> return 0;
Maybe drop this part too,
diff --git a/mm/memory.c b/mm/memory.c
index 410ba50ca746..07343c1469e0 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -5523,6 +5523,7 @@ static vm_fault_t do_numa_page(struct vm_fault *vmf)
if (!migrate_misplaced_folio(folio, vma, target_nid)) {
nid = target_nid;
flags |= TNF_MIGRATED;
+ goto out;
} else {
flags |= TNF_MIGRATE_FAIL;
vmf->pte = pte_offset_map_lock(vma->vm_mm, vmf->pmd,
@@ -5533,12 +5534,8 @@ static vm_fault_t do_numa_page(struct vm_fault *vmf)
pte_unmap_unlock(vmf->pte, vmf->ptl);
return 0;
}
- goto out_map;
}
- if (nid != NUMA_NO_NODE)
- task_numa_fault(last_cpupid, nid, nr_pages, flags);
- return 0;
out_map:
/*
* Make it present again, depending on how arch implements
@@ -5551,6 +5548,7 @@ static vm_fault_t do_numa_page(struct vm_fault *vmf)
numa_rebuild_single_mapping(vmf, vma, vmf->address,
vmf->pte,
writable);
pte_unmap_unlock(vmf->pte, vmf->ptl);
+out:
if (nid != NUMA_NO_NODE)
task_numa_fault(last_cpupid, nid, nr_pages, flags);
return 0;
>>>> @@ -5552,7 +5551,9 @@ static vm_fault_t do_numa_page(struct vm_fault *vmf)
>>>> numa_rebuild_single_mapping(vmf, vma, vmf->address, vmf->pte,
>>>> writable);
>>>> pte_unmap_unlock(vmf->pte, vmf->ptl);
>>>> - goto out;
>>>> + if (nid != NUMA_NO_NODE)
>>>> + task_numa_fault(last_cpupid, nid, nr_pages, flags);
>>>> + return 0;
>>>> }
>>>
>>> Looks good to me. Thanks.
>>>
>>> Hi Andrew,
>>>
>>> Should I resend this for an easy back porting? Or you want to fold David’s
>>> changes in directly?
>>
>> Note that I didn't touch huge_memory.c. So maybe just send a fixup on top?
>
> Got it. The fixup is attached.
>
> Best Regards,
> Yan, Zi
next prev parent reply other threads:[~2024-08-08 14:37 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-07 18:47 Zi Yan
2024-08-07 18:47 ` [PATCH 2/2] mm/migrate: move common code to numa_migrate_check (was numa_migrate_prep) Zi Yan
2024-08-08 4:14 ` Huang, Ying
2024-08-08 14:59 ` Zi Yan
2024-08-08 23:13 ` Zi Yan
2024-08-08 3:19 ` [PATCH 1/2] mm/numa: no task_numa_fault() call if page table is changed Baolin Wang
2024-08-08 8:22 ` David Hildenbrand
2024-08-08 9:25 ` Baolin Wang
2024-08-08 14:13 ` Zi Yan
2024-08-08 14:14 ` David Hildenbrand
2024-08-08 14:21 ` Zi Yan
2024-08-08 14:36 ` Kefeng Wang [this message]
2024-08-08 14:57 ` Zi Yan
2024-08-08 15:12 ` Zi Yan
2024-08-09 1:25 ` Huang, Ying
2024-08-09 2:05 ` Zi Yan
2024-08-09 7:52 ` Huang, Ying
2024-08-09 13:28 ` Zi Yan
2024-08-09 13:49 ` David Hildenbrand
2024-08-09 14:17 ` Zi Yan
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=b0b94a65-51f1-459e-879f-696baba85399@huawei.com \
--to=wangkefeng.wang@huawei.com \
--cc=akpm@linux-foundation.org \
--cc=baolin.wang@linux.alibaba.com \
--cc=david@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=stable@vger.kernel.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
all inboxes | Powered by JetHome®