From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.7 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 95DA3C433E0 for ; Tue, 16 Jun 2020 04:08:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 786132070C for ; Tue, 16 Jun 2020 04:08:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726101AbgFPEIh (ORCPT ); Tue, 16 Jun 2020 00:08:37 -0400 Received: from foss.arm.com ([217.140.110.172]:58900 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725306AbgFPEIh (ORCPT ); Tue, 16 Jun 2020 00:08:37 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 002E51F1; Mon, 15 Jun 2020 21:08:36 -0700 (PDT) Received: from p8cg001049571a15.arm.com (unknown [10.163.80.105]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 2DADD3F6CF; Mon, 15 Jun 2020 21:08:34 -0700 (PDT) From: Anshuman Khandual To: linux-mm@kvack.org Cc: Anshuman Khandual , Arnd Bergmann , linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] mm/pgtable: Move extern zero_pfn outside __HAVE_COLOR_ZERO_PAGE Date: Tue, 16 Jun 2020 09:38:18 +0530 Message-Id: <1592280498-15442-1-git-send-email-anshuman.khandual@arm.com> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org zero_pfn variable is required whether __HAVE_COLOR_ZERO_PAGE is enabled or not. Also it should not really be declared individually in all functions where it gets used. Just move the declaration outside, which also makes it available for other potential users. Cc: Arnd Bergmann Cc: linux-arch@vger.kernel.org Cc: linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Anshuman Khandual --- Applies on 5.8-rc1. If the earlier motivation was to hide zero_pfn from general visibility, we could just put in a comment and update the commit message that my_zero_pfn() should always be used rather than zero_pfn. Build tested on many platforms and boot tested on arm64, x86. include/linux/pgtable.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/include/linux/pgtable.h b/include/linux/pgtable.h index 32b6c52d41b9..078e9864abca 100644 --- a/include/linux/pgtable.h +++ b/include/linux/pgtable.h @@ -1020,10 +1020,11 @@ extern void untrack_pfn(struct vm_area_struct *vma, unsigned long pfn, extern void untrack_pfn_moved(struct vm_area_struct *vma); #endif +extern unsigned long zero_pfn; + #ifdef __HAVE_COLOR_ZERO_PAGE static inline int is_zero_pfn(unsigned long pfn) { - extern unsigned long zero_pfn; unsigned long offset_from_zero_pfn = pfn - zero_pfn; return offset_from_zero_pfn <= (zero_page_mask >> PAGE_SHIFT); } @@ -1033,13 +1034,11 @@ static inline int is_zero_pfn(unsigned long pfn) #else static inline int is_zero_pfn(unsigned long pfn) { - extern unsigned long zero_pfn; return pfn == zero_pfn; } static inline unsigned long my_zero_pfn(unsigned long addr) { - extern unsigned long zero_pfn; return zero_pfn; } #endif -- 2.20.1