From: Kefeng Wang <wangkefeng.wang@huawei.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: <linux-mm@kvack.org>, David Hildenbrand <david@kernel.org>,
"Liam R . Howlett" <liam@infradead.org>,
Lorenzo Stoakes <ljs@kernel.org>,
Vlastimil Babka <vbabka@kernel.org>, Jann Horn <jannh@google.com>,
Pedro Falcato <pfalcato@suse.de>, Zi Yan <ziy@nvidia.com>,
Kefeng Wang <wangkefeng.wang@huawei.com>
Subject: [PATCH v3-fixup 5/6] mm: mincore: fixup improve mincore_hugetlb()
Date: Mon, 20 Jul 2026 20:42:52 +0800 [thread overview]
Message-ID: <20260720124252.1483984-1-wangkefeng.wang@huawei.com> (raw)
In-Reply-To: <20260717091347.1144789-6-wangkefeng.wang@huawei.com>
- change unsigned long nr to const
- remove a local vec variable
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
mm/mincore.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/mm/mincore.c b/mm/mincore.c
index 9ea81638d09f..ff4ac8281768 100644
--- a/mm/mincore.c
+++ b/mm/mincore.c
@@ -28,8 +28,7 @@ static int mincore_hugetlb(pte_t *pte, unsigned long hmask, unsigned long addr,
unsigned long end, struct mm_walk *walk)
{
#ifdef CONFIG_HUGETLB_PAGE
- unsigned long nr = (end - addr) >> PAGE_SHIFT;
- unsigned char *vec = walk->private;
+ const unsigned long nr = (end - addr) >> PAGE_SHIFT;
unsigned char resident;
spinlock_t *ptl;
pte_t ptep;
@@ -37,7 +36,7 @@ static int mincore_hugetlb(pte_t *pte, unsigned long hmask, unsigned long addr,
ptl = huge_pte_lock(hstate_vma(walk->vma), walk->mm, pte);
ptep = huge_ptep_get(walk->mm, addr, pte);
resident = !huge_pte_none(ptep) && !pte_is_marker(ptep);
- memset(vec, resident, nr);
+ memset(walk->private, resident, nr);
walk->private += nr;
spin_unlock(ptl);
#else
--
2.55.0
next prev parent reply other threads:[~2026-07-20 12:43 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20260717091347.1144789-1-wangkefeng.wang@huawei.com>
[not found] ` <20260717091347.1144789-2-wangkefeng.wang@huawei.com>
2026-07-20 9:21 ` [PATCH v3 1/6] mm: introduce pud_is_huge() helper David Hildenbrand (Arm)
[not found] ` <20260717091347.1144789-6-wangkefeng.wang@huawei.com>
2026-07-20 9:27 ` [PATCH v3 5/6] mm: mincore: improve mincore_hugetlb() David Hildenbrand (Arm)
2026-07-20 12:42 ` Kefeng Wang [this message]
[not found] ` <20260717091347.1144789-3-wangkefeng.wang@huawei.com>
2026-07-20 9:25 ` [PATCH v3 2/6] mm: mincore: remove special handling for VM_PFNMAP David Hildenbrand (Arm)
2026-07-20 9:26 ` David Hildenbrand (Arm)
2026-07-20 12:41 ` [PATCH v3-fixup 2/6] mm: mincore: fixup for " 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=20260720124252.1483984-1-wangkefeng.wang@huawei.com \
--to=wangkefeng.wang@huawei.com \
--cc=akpm@linux-foundation.org \
--cc=david@kernel.org \
--cc=jannh@google.com \
--cc=liam@infradead.org \
--cc=linux-mm@kvack.org \
--cc=ljs@kernel.org \
--cc=pfalcato@suse.de \
--cc=vbabka@kernel.org \
--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