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=-8.5 required=3.0 tests=INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 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 EB288CA9EB9 for ; Wed, 23 Oct 2019 14:38:53 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 9DA1A2173B for ; Wed, 23 Oct 2019 14:38:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9DA1A2173B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id F0DC86B0005; Wed, 23 Oct 2019 10:38:52 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id EBF1B6B0008; Wed, 23 Oct 2019 10:38:52 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DD46B6B000D; Wed, 23 Oct 2019 10:38:52 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id BB46D6B0005 for ; Wed, 23 Oct 2019 10:38:52 -0400 (EDT) Received: from smtpin10.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with SMTP id 62DC8824999B for ; Wed, 23 Oct 2019 14:38:52 +0000 (UTC) X-FDA: 76075306104.10.drain54_4d6a351d1683e X-HE-Tag: drain54_4d6a351d1683e X-Filterd-Recvd-Size: 3243 Received: from mx1.suse.de (mx2.suse.de [195.135.220.15]) by imf41.hostedemail.com (Postfix) with ESMTP for ; Wed, 23 Oct 2019 14:38:51 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 5178AAC10; Wed, 23 Oct 2019 14:38:50 +0000 (UTC) Date: Wed, 23 Oct 2019 16:38:47 +0200 From: Michal Hocko To: Chen Wandun Cc: akpm@linux-foundation.org, vbabka@suse.cz, osalvador@suse.de, mgorman@techsingularity.net, rppt@linux.ibm.com, dan.j.williams@intel.com, alexander.h.duyck@linux.intel.com, anshuman.khandual@arm.com, pavel.tatashin@microsoft.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm/page_alloc: fix gcc compile warning Message-ID: <20191023143847.GJ17610@dhcp22.suse.cz> References: <1571838508-117928-1-git-send-email-chenwandun@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1571838508-117928-1-git-send-email-chenwandun@huawei.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Wed 23-10-19 21:48:28, Chen Wandun wrote: > From: Chenwandun > > mm/page_alloc.o: In function `page_alloc_init_late': > mm/page_alloc.c:1956: undefined reference to `zone_pcp_update' > mm/page_alloc.o:(.debug_addr+0x8350): undefined reference to `zone_pcp_update' > make: *** [vmlinux] Error 1 > > zone_pcp_update is defined in CONFIG_MEMORY_HOTPLUG, > so add ifdef when calling zone_pcp_update. David has already pointed out that this has been fixed already but let me note one more thing. This patch is wrong at two levels. The first one that it simply does a wrong thing. The comment above the code explains why zone_pcp_update is called and ifdef makes it depend on MEMORY_HOTPLUG support which has nothing to do with that code. The second problem and I find it as a reoccuring problem (and that's why I am writing this reply) that the changelog explains what but it doesn't say why. It would certainly be unsatisfactory to say "because compiler complains". So there would have to be a clarification that zone_pcp_update is only available for CONFIG_MEMORY_HOTPLUG and why the code only applies to those configuration. That would be much harder to justify because there is no real connection. That being said, a proper changelog with a good explanation of what and why can help to discover a wrong patch early. > Signed-off-by: Chenwandun > --- > mm/page_alloc.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/mm/page_alloc.c b/mm/page_alloc.c > index f9488ef..8513150 100644 > --- a/mm/page_alloc.c > +++ b/mm/page_alloc.c > @@ -1952,8 +1952,10 @@ void __init page_alloc_init_late(void) > * so the pcpu batch and high limits needs to be updated or the limits > * will be artificially small. > */ > +#ifdef CONFIG_MEMORY_HOTPLUG > for_each_populated_zone(zone) > zone_pcp_update(zone); > +#endif > > /* > * We initialized the rest of the deferred pages. Permanently disable > -- > 2.7.4 -- Michal Hocko SUSE Labs