Re: [PATCH v2 1/2] mm: introduce pmd_install() helper

From: Qi Zheng
Date: Wed Sep 01 2021 - 06:15:54 EST

On 2021/9/1 AM7:23, Kirill A. Shutemov wrote:
On Tue, Aug 31, 2021 at 09:21:10PM +0800, Qi Zheng wrote:
Currently we have three times the same few lines repeated in the
code. Deduplicate them by newly introduced pmd_install() helper.

Signed-off-by: Qi Zheng <zhengqi.arch@xxxxxxxxxxxxx>
Reviewed-by: David Hildenbrand <david@xxxxxxxxxx>
Reviewed-by: Muchun Song <songmuchun@xxxxxxxxxxxxx>
include/linux/mm.h | 1 +
mm/filemap.c | 11 ++---------
mm/memory.c | 34 ++++++++++++++++------------------
3 files changed, 19 insertions(+), 27 deletions(-)

diff --git a/include/linux/mm.h b/include/linux/mm.h
index a3cc83d64564..0af420a7e382 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -2463,6 +2463,7 @@ static inline spinlock_t *pud_lock(struct mm_struct *mm, pud_t *pud)
return ptl;
+extern void pmd_install(struct mm_struct *mm, pmd_t *pmd, pgtable_t *pte);
extern void __init pagecache_init(void);
extern void __init free_area_init_memoryless_node(int nid);
extern void free_initmem(void);

mm/internal.h would be a better fit for the declaration.

OK, I will update it in the next version.


Acked-by: Kirill A. Shutemov <kirill.shutemov@xxxxxxxxxxxxxxx>