From: Feng Lee <379943137@qq.com>
To: david@redhat.com, baohua@kernel.org, 21cnbao@gmail.com,
akpm@linux-foundation.org, mingo@kernel.org, jgg@ziepe.ca,
jhubbard@nvidia.com, peterx@redhat.com
Cc: maobibo@loongson.cn, trivial@kernel.org,
linux-kernel@vger.kernel.org, lance.yang@linux.dev,
anshuman.khandual@arm.com, Feng Lee <379943137@qq.com>
Subject: [PATCH v2] mm: clean up redundant code
Date: Thu, 8 May 2025 22:01:15 +0800 [thread overview]
Message-ID: <tencent_0B227ECF6D12D91A3070FE8D41568AD10206@qq.com> (raw)
Remove pgd_offset_gate() completely and simply make the single
caller use pgd_offset()
It appears that the gate area resides in the kernel-mapped segment
exclusively on IA64. Therefore, removing pgd_offset_k is safe since
IA64 is now obsolete.
Signed-off-by: Feng Lee <379943137@qq.com>
---
Changes in v2:
- remove pgd_offset_gate completely
- remove pgd_offset_k from the get_gate_page function completely
---
include/linux/pgtable.h | 4 ----
mm/gup.c | 5 +----
2 files changed, 1 insertion(+), 8 deletions(-)
diff --git a/include/linux/pgtable.h b/include/linux/pgtable.h
index b50447ef1c92..f1e890b60460 100644
--- a/include/linux/pgtable.h
+++ b/include/linux/pgtable.h
@@ -1164,10 +1164,6 @@ static inline void arch_swap_restore(swp_entry_t entry, struct folio *folio)
}
#endif
-#ifndef __HAVE_ARCH_PGD_OFFSET_GATE
-#define pgd_offset_gate(mm, addr) pgd_offset(mm, addr)
-#endif
-
#ifndef __HAVE_ARCH_MOVE_PTE
#define move_pte(pte, old_addr, new_addr) (pte)
#endif
diff --git a/mm/gup.c b/mm/gup.c
index f32168339390..0685403fe510 100644
--- a/mm/gup.c
+++ b/mm/gup.c
@@ -1101,10 +1101,7 @@ static int get_gate_page(struct mm_struct *mm, unsigned long address,
/* user gate pages are read-only */
if (gup_flags & FOLL_WRITE)
return -EFAULT;
- if (address > TASK_SIZE)
- pgd = pgd_offset_k(address);
- else
- pgd = pgd_offset_gate(mm, address);
+ pgd = pgd_offset(mm, address);
if (pgd_none(*pgd))
return -EFAULT;
p4d = p4d_offset(pgd, address);
--
2.49.0
next reply other threads:[~2025-05-09 2:14 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-08 14:01 Feng Lee [this message]
2025-05-09 2:44 ` Barry Song
2025-05-09 3:06 ` Feng Lee
2025-05-09 8:22 ` David Hildenbrand
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=tencent_0B227ECF6D12D91A3070FE8D41568AD10206@qq.com \
--to=379943137@qq.com \
--cc=21cnbao@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=anshuman.khandual@arm.com \
--cc=baohua@kernel.org \
--cc=david@redhat.com \
--cc=jgg@ziepe.ca \
--cc=jhubbard@nvidia.com \
--cc=lance.yang@linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=maobibo@loongson.cn \
--cc=mingo@kernel.org \
--cc=peterx@redhat.com \
--cc=trivial@kernel.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
all inboxes | Powered by JetHome®