From nobody Fri Dec 19 20:39:59 2025 Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5E275184; Fri, 7 Nov 2025 09:59:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=114.242.206.163 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762509590; cv=none; b=V6kqA5ts8SLZvGf/iyI7fEprNX8TAK1UglrPOEXnIzJI2aSTdAAZNAQBMi0k1jsD9EfO67uAkZ4M6SnbASMLsFuN7o8o0Iexrqg3uQpszO62z3sPMpZqzGMnjymdi9NIUXUxsJlJ7zJO7zeDVHyBsak+JGsAHLOS03LHvU/NVoc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762509590; c=relaxed/simple; bh=dSn4bpScevxDxseiwBrGPM6q9KPe63Brm/aAq2AAz08=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=SgUNynr9KE4J1rd21ByKPOaEZkj7nLZ+hE1L7UoJhcTM944wqcwwInWBKKg30Xbh2GKnRk4D7E+0+CnXr1BZ9sccrY7r3YTieQFhtP+v2YGmc5YBd0oIBXLrrBrWJhUT529GUdolhpRPKBi8mLiDpFhGV2kFIHGrVx6ihWdG/Qs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=loongson.cn; spf=pass smtp.mailfrom=loongson.cn; arc=none smtp.client-ip=114.242.206.163 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=loongson.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=loongson.cn Received: from loongson.cn (unknown [223.64.68.45]) by gateway (Coremail) with SMTP id _____8Axz78Lww1pukIgAA--.2298S3; Fri, 07 Nov 2025 17:59:39 +0800 (CST) Received: from localhost.localdomain (unknown [223.64.68.45]) by front1 (Coremail) with SMTP id qMiowJAx_8EGww1ptL4qAQ--.58299S2; Fri, 07 Nov 2025 17:59:38 +0800 (CST) From: Huacai Chen To: Huacai Chen , Andrew Morton Cc: Arnd Bergmann , Vishal Moola , Kevin Brodsky , Jan Kara , linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org, Huacai Chen Subject: [PATCH Resend] mm: Refine __{pgd,p4d,pud,pmd,pte}_alloc_one_*() about HIGHMEM Date: Fri, 7 Nov 2025 17:59:22 +0800 Message-ID: <20251107095922.3106390-1-chenhuacai@loongson.cn> X-Mailer: git-send-email 2.47.3 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-CM-TRANSID: qMiowJAx_8EGww1ptL4qAQ--.58299S2 X-CM-SenderInfo: hfkh0x5xdftxo6or00hjvr0hdfq/ X-Coremail-Antispam: 1Uk129KBj93XoW7uw1fGryUXF4rKr1xAr43urX_yoW8CryxpF s7C3y8X398JFyrWa10y3Z7Cr17tw45GF47AF42gFy5Z3W3tw1xGFyDtFW7ZFZrZFZ5ZFW5 Wrsxtay3AFnIvrcCm3ZEXasCq-sJn29KB7ZKAUJUUUUx529EdanIXcx71UUUUU7KY7ZEXa sCq-sGcSsGvfJ3Ic02F40EFcxC0VAKzVAqx4xG6I80ebIjqfuFe4nvWSU5nxnvy29KBjDU 0xBIdaVrnRJUUUBYb4IE77IF4wAFF20E14v26r1j6r4UM7CY07I20VC2zVCF04k26cxKx2 IYs7xG6rWj6s0DM7CIcVAFz4kK6r1Y6r17M28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48v e4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_Ar0_tr1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI 0_Gr0_Cr1l84ACjcxK6I8E87Iv67AKxVW0oVCq3wA2z4x0Y4vEx4A2jsIEc7CjxVAFwI0_ GcCE3s1ln4kS14v26r126r1DM2AIxVAIcxkEcVAq07x20xvEncxIr21l57IF6xkI12xvs2 x26I8E6xACxx1l5I8CrVACY4xI64kE6c02F40Ex7xfMcIj6xIIjxv20xvE14v26r1q6rW5 McIj6I8E87Iv67AKxVWxJVW8Jr1lOx8S6xCaFVCjc4AY6r1j6r4UM4x0Y48IcxkI7VAKI4 8JMxkF7I0En4kS14v26r126r1DMxAIw28IcxkI7VAKI48JMxC20s026xCaFVCjc4AY6r1j 6r4UMxCIbckI1I0E14v26r126r1DMI8I3I0E5I8CrVAFwI0_Jr0_Jr4lx2IqxVCjr7xvwV AFwI0_JrI_JrWlx4CE17CEb7AF67AKxVWUtVW8ZwCIc40Y0x0EwIxGrwCI42IY6xIIjxv2 0xvE14v26ryj6F1UMIIF0xvE2Ix0cI8IcVCY1x0267AKxVW8JVWxJwCI42IY6xAIw20EY4 v20xvaj40_Jr0_JF4lIxAIcVC2z280aVAFwI0_Gr0_Cr1lIxAIcVC2z280aVCY1x0267AK xVW8JVW8JrUvcSsGvfC2KfnxnUUI43ZEXa7IU82jg7UUUUU== Content-Type: text/plain; charset="utf-8" __{pgd,p4d,pud,pmd,pte}_alloc_one_*() always allocate pages with GFP flag GFP_PGTABLE_KERNEL/GFP_PGTABLE_USER. These two macros are defined as follows: #define GFP_PGTABLE_KERNEL (GFP_KERNEL | __GFP_ZERO) #define GFP_PGTABLE_USER (GFP_PGTABLE_KERNEL | __GFP_ACCOUNT) There is no __GFP_HIGHMEM in them, so we needn't to clear __GFP_HIGHMEM explicitly. Signed-off-by: Huacai Chen Acked-by: Mike Rapoport (Microsoft) --- Resend because the lines begin with # was eaten by git. include/asm-generic/pgalloc.h | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/include/asm-generic/pgalloc.h b/include/asm-generic/pgalloc.h index 3c8ec3bfea44..706e87b43b19 100644 --- a/include/asm-generic/pgalloc.h +++ b/include/asm-generic/pgalloc.h @@ -18,8 +18,7 @@ */ static inline pte_t *__pte_alloc_one_kernel_noprof(struct mm_struct *mm) { - struct ptdesc *ptdesc =3D pagetable_alloc_noprof(GFP_PGTABLE_KERNEL & - ~__GFP_HIGHMEM, 0); + struct ptdesc *ptdesc =3D pagetable_alloc_noprof(GFP_PGTABLE_KERNEL, 0); =20 if (!ptdesc) return NULL; @@ -172,7 +171,6 @@ static inline pud_t *__pud_alloc_one_noprof(struct mm_s= truct *mm, unsigned long =20 if (mm =3D=3D &init_mm) gfp =3D GFP_PGTABLE_KERNEL; - gfp &=3D ~__GFP_HIGHMEM; =20 ptdesc =3D pagetable_alloc_noprof(gfp, 0); if (!ptdesc) @@ -226,7 +224,6 @@ static inline p4d_t *__p4d_alloc_one_noprof(struct mm_s= truct *mm, unsigned long =20 if (mm =3D=3D &init_mm) gfp =3D GFP_PGTABLE_KERNEL; - gfp &=3D ~__GFP_HIGHMEM; =20 ptdesc =3D pagetable_alloc_noprof(gfp, 0); if (!ptdesc) @@ -270,7 +267,6 @@ static inline pgd_t *__pgd_alloc_noprof(struct mm_struc= t *mm, unsigned int order =20 if (mm =3D=3D &init_mm) gfp =3D GFP_PGTABLE_KERNEL; - gfp &=3D ~__GFP_HIGHMEM; =20 ptdesc =3D pagetable_alloc_noprof(gfp, order); if (!ptdesc) --=20 2.47.3