Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp5673579rwi; Tue, 18 Oct 2022 02:28:20 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4NiJCNOWaI1tIL4ORq1M6otKpyh7L98QnzNTu8NYbXrdtD8FO3SAdG2A6WA82vnGFxHAai X-Received: by 2002:a17:906:9c83:b0:779:c14c:55e4 with SMTP id fj3-20020a1709069c8300b00779c14c55e4mr1565404ejc.619.1666085300066; Tue, 18 Oct 2022 02:28:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666085300; cv=none; d=google.com; s=arc-20160816; b=dCTTq7CaK6Mzdg7JzMYJw0DLmmWiSUlsXT6yv5HCPfIxsd6YR8cP6T9462Y7pHmmvo iWGrx4Ql0/pyfNA500cA5DrvXcpBpfZ1KS99O1WeCOgqtDG/nfAy5q8Dj3CJQnfoTD12 /P4/ZysJya4JLS+mVFIyxrgHu2UiEzl60gl4a9f67tQ8Ye38YqdmFrqajBzdsSH+M73o QjEJl82ge0ACJCtfjHqUF+SBlv6Lbiwfgzykzxehp+cu/D/v8CB/9WGYz6FJ45Fe+qS4 20EXGuWQkhq6l+D1JTDoTUBPJI3zrJ1EljRk+XYKXVKrCfLi5cCEfJoH+SHackf69weh Yrdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=cmPYhRmWKmO204jpBdg38pzTlYIjYqrhxP0GwlTUkIM=; b=t56fdGjN3gx6je77WEqGH8O4rWGji+1hO3m8jqRam6FyjArWEOY0tqlblbDY31XevT 8boEPM1zY/Atgzaq1+T5IcZEZDg0+FX11p9pfaUNmlzvixLRXMiiS1U+aXItXT77Z2bw 1mYbV4sf/cbGE4+x9JYwVgibQV0f0Kk1EvBUio9YSwYxa4gd+zvpjqOVWZ92dNR2gZiU T1gKS6e7nGesG+aOwfussZioDKUNaUGyZJUHNLVrOOSZyO4GJJQwLQUsWD2IHZRdCB77 P+WYDdhpxsoiLZClm5r/7REtNJKTTKgcrtwl68UHYzR4/CQGEc50gy8wZ3Rk1mkbgPw8 PbZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@xen0n.name header.s=mail header.b=cHV6qrCj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v19-20020a1709062f1300b0078dad3ace2esi9825663eji.676.2022.10.18.02.27.54; Tue, 18 Oct 2022 02:28:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@xen0n.name header.s=mail header.b=cHV6qrCj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229997AbiJRJUi (ORCPT + 99 others); Tue, 18 Oct 2022 05:20:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51202 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230034AbiJRJUc (ORCPT ); Tue, 18 Oct 2022 05:20:32 -0400 Received: from mailbox.box.xen0n.name (mail.xen0n.name [115.28.160.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D8F608F277; Tue, 18 Oct 2022 02:20:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=xen0n.name; s=mail; t=1666084821; bh=N48MFgDUmr1tfKHznoAthvRtR1Wpy0hSpJqTj7oKYC4=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=cHV6qrCjD47k3jGPjUQF3lwihop1RDaw3yjdG73m7BjSD1b/7jyWqLqeN+Uyk642T VvEcixZUqLhrENpMZkopSZmIH+3rzqlov7m3aEUZuBieiNorHcibY7orD6PjU5mrAB wuldpVWm+HQ77bl4gfDeA0Z+scSMeI8G3x4eFq+M= Received: from [100.100.57.122] (unknown [220.248.53.61]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mailbox.box.xen0n.name (Postfix) with ESMTPSA id 69A5760087; Tue, 18 Oct 2022 17:20:20 +0800 (CST) Message-ID: <27ffa400-b947-7c83-0e79-c8eb9f96e12e@xen0n.name> Date: Tue, 18 Oct 2022 17:20:19 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:107.0) Gecko/20100101 Thunderbird/107.0a1 Subject: Re: [PATCH] mm: remove kern_addr_valid() completely Content-Language: en-US To: Kefeng Wang , Andrew Morton , linux-alpha@vger.kernel.org, linux-kernel@vger.kernel.org, linux-snps-arc@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, linux-ia64@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, openrisc@lists.librecores.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-um@lists.infradead.org, linux-xtensa@linux-xtensa.org, linux-fsdevel@vger.kernel.org Cc: Richard Henderson , Ivan Kokshaysky , Matt Turner , Vineet Gupta , Russell King , Catalin Marinas , Will Deacon , Guo Ren , Huacai Chen , Geert Uytterhoeven , Greg Ungerer , Michal Simek , Thomas Bogendoerfer , Dinh Nguyen , Jonas Bonn , Stefan Kristiansson , Stafford Horne , "James E . J . Bottomley" , Helge Deller , Michael Ellerman , Nicholas Piggin , Christophe Leroy , Paul Walmsley , Palmer Dabbelt , Albert Ou , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , Yoshinori Sato , Rich Felker , "David S . Miller" , Richard Weinberger , Anton Ivanov , Johannes Berg , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H . Peter Anvin" , Andy Lutomirski , Peter Zijlstra , Chris Zankel , Max Filippov References: <20221018074014.185687-1-wangkefeng.wang@huawei.com> From: WANG Xuerui In-Reply-To: <20221018074014.185687-1-wangkefeng.wang@huawei.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2022/10/18 15:40, Kefeng Wang wrote: > Most architectures(except arm64/x86/sparc) simply return 1 for one space before the opening parens > kern_addr_valid(), which is only used in read_kcore(), and it > calls copy_from_kernel_nofault() which could check whether the > address is a valid kernel address, so no need kern_addr_valid(), minor grammatical nit: "... which already checks whether the address is a valid kernel address. So kern_addr_valid is unnecessary, let's remove it." > let's remove unneeded kern_addr_valid() completely. > > Signed-off-by: Kefeng Wang > --- > arch/alpha/include/asm/pgtable.h | 2 - > arch/arc/include/asm/pgtable-bits-arcv2.h | 2 - > arch/arm/include/asm/pgtable-nommu.h | 2 - > arch/arm/include/asm/pgtable.h | 4 -- > arch/arm64/include/asm/pgtable.h | 2 - > arch/arm64/mm/mmu.c | 47 ----------------------- > arch/arm64/mm/pageattr.c | 3 +- > arch/csky/include/asm/pgtable.h | 3 -- > arch/hexagon/include/asm/page.h | 7 ---- > arch/ia64/include/asm/pgtable.h | 16 -------- > arch/loongarch/include/asm/pgtable.h | 2 - > arch/m68k/include/asm/pgtable_mm.h | 2 - > arch/m68k/include/asm/pgtable_no.h | 1 - > arch/microblaze/include/asm/pgtable.h | 3 -- > arch/mips/include/asm/pgtable.h | 2 - > arch/nios2/include/asm/pgtable.h | 2 - > arch/openrisc/include/asm/pgtable.h | 2 - > arch/parisc/include/asm/pgtable.h | 15 -------- > arch/powerpc/include/asm/pgtable.h | 7 ---- > arch/riscv/include/asm/pgtable.h | 2 - > arch/s390/include/asm/pgtable.h | 2 - > arch/sh/include/asm/pgtable.h | 2 - > arch/sparc/include/asm/pgtable_32.h | 6 --- > arch/sparc/mm/init_32.c | 3 +- > arch/sparc/mm/init_64.c | 1 - > arch/um/include/asm/pgtable.h | 2 - > arch/x86/include/asm/pgtable_32.h | 9 ----- > arch/x86/include/asm/pgtable_64.h | 1 - > arch/x86/mm/init_64.c | 41 -------------------- > arch/xtensa/include/asm/pgtable.h | 2 - > fs/proc/kcore.c | 26 +++++-------- > 31 files changed, 11 insertions(+), 210 deletions(-) > > diff --git a/arch/loongarch/include/asm/pgtable.h b/arch/loongarch/include/asm/pgtable.h > index 946704bee599..fc70b7041b76 100644 > --- a/arch/loongarch/include/asm/pgtable.h > +++ b/arch/loongarch/include/asm/pgtable.h > @@ -421,8 +421,6 @@ static inline void update_mmu_cache_pmd(struct vm_area_struct *vma, > __update_tlb(vma, address, (pte_t *)pmdp); > } > > -#define kern_addr_valid(addr) (1) > - > static inline unsigned long pmd_pfn(pmd_t pmd) > { > return (pmd_val(pmd) & _PFN_MASK) >> _PFN_SHIFT; Acked-by: WANG Xuerui # loongarch Thanks! -- WANG "xen0n" Xuerui Linux/LoongArch mailing list: https://lore.kernel.org/loongarch/