From: David Hildenbrand <david@redhat.com>
To: Barry Song <21cnbao@gmail.com>, Feng Lee <379943137@qq.com>
Cc: akpm@linux-foundation.org, ryan.roberts@arm.com,
libang.li@antgroup.com, peterx@redhat.com, maobibo@loongson.cn,
lance.yang@linux.dev, anshuman.khandual@arm.com,
trivial@kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm: remove useless code
Date: Mon, 28 Apr 2025 09:17:03 +0200 [thread overview]
Message-ID: <d8228c02-b5c0-47cd-927f-9054d412c7ea@redhat.com> (raw)
In-Reply-To: <CAGsJ_4wWK6B8GSc=cxPGnPU0Jt_o0YB55yk4+VNOm_hY_iditA@mail.gmail.com>
On 27.04.25 10:22, Barry Song wrote:
> On Sun, Apr 27, 2025 at 2:16 PM Feng Lee <379943137@qq.com> wrote:
>>
>> Remove unused conditional macros.
>>
>> Signed-off-by: Feng Lee <379943137@qq.com>
>> ---
>> include/linux/pgtable.h | 2 --
>> 1 file changed, 2 deletions(-)
>>
>> diff --git a/include/linux/pgtable.h b/include/linux/pgtable.h
>> index b50447ef1c92..47c5a54b7551 100644
>> --- a/include/linux/pgtable.h
>> +++ b/include/linux/pgtable.h
>> @@ -1164,9 +1164,7 @@ 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
>
> Do you know who else had pgd_offset_gate() before except ia64?
>
> /* Look up a pgd entry in the gate area. On IA-64, the gate-area
> resides in the kernel-mapped segment, hence we use pgd_offset_k()
> here. */
> #define pgd_offset_gate(mm, addr) pgd_offset_k(addr)
>
> btw, do we still
> need pgd_offset_gate() given that nobody needs it now?
>
> 1 1168 include/linux/pgtable.h <<GLOBAL>>
> #define pgd_offset_gate(mm, addr) pgd_offset(mm, addr)
>
> 2 1112 mm/gup.c <<get_gate_page>>
> pgd = pgd_offset_gate(mm, address);
>
Right, we should just remove pgd_offset_gate() completely in this patch
and simply make the single caller use pgd_offset().
I think we can even do:
diff --git a/mm/gup.c b/mm/gup.c
index 84461d384ae2b..05dd87ccce155 100644
--- a/mm/gup.c
+++ b/mm/gup.c
@@ -1106,10 +1106,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(address);
if (pgd_none(*pgd))
return -EFAULT;
p4d = p4d_offset(pgd, address);
Unless I am missing something important :)
--
Cheers,
David / dhildenb
next prev parent reply other threads:[~2025-04-28 7:17 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-27 6:13 Feng Lee
2025-04-27 8:22 ` Barry Song
2025-04-28 7:17 ` David Hildenbrand [this message]
2025-04-28 11:03 ` Barry Song
2025-04-28 13:59 ` David Hildenbrand
2025-04-30 23:23 ` Barry Song
2025-05-08 12:47 ` Feng Lee
2025-05-08 14:39 ` David Hildenbrand
2025-04-29 8:13 ` Feng Lee
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=d8228c02-b5c0-47cd-927f-9054d412c7ea@redhat.com \
--to=david@redhat.com \
--cc=21cnbao@gmail.com \
--cc=379943137@qq.com \
--cc=akpm@linux-foundation.org \
--cc=anshuman.khandual@arm.com \
--cc=lance.yang@linux.dev \
--cc=libang.li@antgroup.com \
--cc=linux-kernel@vger.kernel.org \
--cc=maobibo@loongson.cn \
--cc=peterx@redhat.com \
--cc=ryan.roberts@arm.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®