Received: by 2002:a05:6358:53a8:b0:117:f937:c515 with SMTP id z40csp3756352rwe; Mon, 17 Apr 2023 03:08:40 -0700 (PDT) X-Google-Smtp-Source: AKy350Y6LfLn/SlQzXiTMcafWvwftTIMWiSgzXn7FY50ABYUW/bBW+NMNRdD0J2ybmYnCcfwHHAp X-Received: by 2002:a17:902:e88d:b0:1a1:cef2:accf with SMTP id w13-20020a170902e88d00b001a1cef2accfmr15552552plg.30.1681726119811; Mon, 17 Apr 2023 03:08:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681726119; cv=none; d=google.com; s=arc-20160816; b=YA8DTF9zL0rNqi7zeckfioYGPMBZs/7B4ZMKeCQSIOAtTtWmDYpuIz4LOClrBDKVJg Szzdbna3ZvBC0R52pPoPWYZMICqomBSi4f7M7dTTy7KaADnnhgaaApYNnd9zyNtgws0X 8H33n1enmDVKZ8SXVKUG57C0V3ZeEuQs6kcVO5kjtAetYnk1vQzvokBiaD/IJLTuPULU UfwfVIU4O6zjR67XUdOuoviVPmoYLCL8EOmPdqYsalbgNCBj2zBFcMb/t20/kzYDL97k /xEuNUXOQAQQhmLjIj2iXFtdhwRo3dwFR4x0PNLe9dkYUg5QBkJnwiaK56TO7OzAd2NQ ozgw== 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:dkim-signature; bh=T8fabMzfAGjYP0BKz9hKFICr8htAJHIgLHPI3ASfU3Y=; b=oZwWZqEifbpXq4uDawf2Al+p1Sdf/UEnozXa70a/BZJMZlrfOahsBiwxJtuAzHnJb/ 6tKcv7O08fzfUx+GXuD8IZsBFku9kq6PC8vjUUL59s8ScJMx0jVlu5NAMJCfp/ilPjBf eJ7rFLu3ZxQ4P2d5kbEgmcMwEPO00tbRawBKBHgowKbJ7E5LVhyuTzhdIfe2TJOrfOj1 u8+XGYQtwvs5SPA0NttWqMxDwjglmGrvXHi4sYzIaFgKY0YTT335sHfBcTUVeQe7h0Bz b43MzFkIUtngP4jCV462Ep5x65cyOxm0j99kcNfN/pB3Xtg+tb4A8YU7ir4q9Q0wE0mH jkfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=x3m71yKh; dkim=neutral (no key) header.i=@suse.cz; 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 ix21-20020a170902f81500b0019cd3a6016esi11404503plb.210.2023.04.17.03.08.28; Mon, 17 Apr 2023 03:08:39 -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=@suse.cz header.s=susede2_rsa header.b=x3m71yKh; dkim=neutral (no key) header.i=@suse.cz; 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 S230390AbjDQKIU (ORCPT + 99 others); Mon, 17 Apr 2023 06:08:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42796 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229598AbjDQKIR (ORCPT ); Mon, 17 Apr 2023 06:08:17 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EFD3C6A78 for ; Mon, 17 Apr 2023 03:07:39 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 4A63B21A4F; Mon, 17 Apr 2023 10:05:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1681725935; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=T8fabMzfAGjYP0BKz9hKFICr8htAJHIgLHPI3ASfU3Y=; b=x3m71yKhdvmuBlg8QOf5PuKlKQHoRWyjXLkNrFDX+MuM6ItA8xxYSiw/ER4YXWMV52BKOq cKHP3/kZdcOq7+8J9+KMMMHRfOTrB1saDQHR5r8Wpg6Cpc6563HMWZp/Fe308Thc+VQAn9 /k1eOkEQX+8Pe55Oh/Mxi4cZURNMFe0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1681725935; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=T8fabMzfAGjYP0BKz9hKFICr8htAJHIgLHPI3ASfU3Y=; b=hyQgOgVfxD4SWY/sZeKOyYctwFET7dw5pbiknDMQnkwXPnZU+474gLlDsSSKo9n+7v3Y5T vBU5YkICotyLboAA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id E64EA1390E; Mon, 17 Apr 2023 10:05:34 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id AontNu4ZPWTAeAAAMHmgww (envelope-from ); Mon, 17 Apr 2023 10:05:34 +0000 Message-ID: <5a5e21d1-b346-2943-3ec0-e84f03551998@suse.cz> Date: Mon, 17 Apr 2023 12:05:34 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.9.0 Subject: Re: [PATCH] [v2] mm: make arch_has_descending_max_zone_pfns() static Content-Language: en-US To: Arnd Bergmann , Andrew Morton Cc: Arnd Bergmann , llvm@lists.linux.dev, Vineet Gupta , Mike Rapoport , Nathan Chancellor , Nick Desaulniers , Tom Rix , David Hildenbrand , "Liam R. Howlett" , "Matthew Wilcox (Oracle)" , Suren Baghdasaryan , Naoya Horiguchi , linux-snps-arc@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org References: <20230415081904.969049-1-arnd@kernel.org> From: Vlastimil Babka In-Reply-To: <20230415081904.969049-1-arnd@kernel.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 4/15/23 10:18, Arnd Bergmann wrote: > From: Arnd Bergmann > > clang produces a build failure on x86 for some randconfig builds > after a change that moves around code to mm/mm_init.c: > > Cannot find symbol for section 2: .text. > mm/mm_init.o: failed > > I have not been able to figure out why this happens, but the __weak > annotation on arch_has_descending_max_zone_pfns() is the trigger here. > > Removing the weak function in favor of an open-coded Kconfig option > check avoids the problem and becomes clearer as well as better to > optimize by the compiler. > > Fixes: 9420f89db2dd ("mm: move most of core MM initialization to mm/mm_init.c") > Cc: llvm@lists.linux.dev > Signed-off-by: Arnd Bergmann Makes sense if there's only a single arch that has the special case. Acked-by: Vlastimil Babka > --- > v2: fix logic bug reported-by: kernel test robot , > see https://lore.kernel.org/oe-lkp/202304151422.5e4d380b-oliver.sang@intel.com > --- > arch/arc/mm/init.c | 5 ----- > include/linux/mm.h | 1 - > mm/mm_init.c | 4 ++-- > 3 files changed, 2 insertions(+), 8 deletions(-) > > diff --git a/arch/arc/mm/init.c b/arch/arc/mm/init.c > index ce4e939a7f07..2b89b6c53801 100644 > --- a/arch/arc/mm/init.c > +++ b/arch/arc/mm/init.c > @@ -74,11 +74,6 @@ void __init early_init_dt_add_memory_arch(u64 base, u64 size) > base, TO_MB(size), !in_use ? "Not used":""); > } > > -bool arch_has_descending_max_zone_pfns(void) > -{ > - return !IS_ENABLED(CONFIG_ARC_HAS_PAE40); > -} > - > /* > * First memory setup routine called from setup_arch() > * 1. setup swapper's mm @init_mm > diff --git a/include/linux/mm.h b/include/linux/mm.h > index 63acf4a598fe..75d8adce0aee 100644 > --- a/include/linux/mm.h > +++ b/include/linux/mm.h > @@ -3061,7 +3061,6 @@ extern void setup_per_cpu_pageset(void); > extern int min_free_kbytes; > extern int watermark_boost_factor; > extern int watermark_scale_factor; > -extern bool arch_has_descending_max_zone_pfns(void); > > /* nommu.c */ > extern atomic_long_t mmap_pages_allocated; > diff --git a/mm/mm_init.c b/mm/mm_init.c > index 35302b7bca83..7f7f9c677854 100644 > --- a/mm/mm_init.c > +++ b/mm/mm_init.c > @@ -1754,9 +1754,9 @@ static void __init free_area_init_memoryless_node(int nid) > * Some architectures, e.g. ARC may have ZONE_HIGHMEM below ZONE_NORMAL. For > * such cases we allow max_zone_pfn sorted in the descending order > */ > -bool __weak arch_has_descending_max_zone_pfns(void) > +static bool arch_has_descending_max_zone_pfns(void) > { > - return false; > + return IS_ENABLED(CONFIG_ARC) && !IS_ENABLED(CONFIG_ARC_HAS_PAE40); > } > > /**