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 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8B72DC433EF for ; Thu, 14 Oct 2021 07:08:57 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 3578460FE8 for ; Thu, 14 Oct 2021 07:08:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 3578460FE8 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id BF7AF94001B; Thu, 14 Oct 2021 03:08:56 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B805D6B00A9; Thu, 14 Oct 2021 03:08:56 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9F9E094001B; Thu, 14 Oct 2021 03:08:56 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0132.hostedemail.com [216.40.44.132]) by kanga.kvack.org (Postfix) with ESMTP id 8E0356B00A8 for ; Thu, 14 Oct 2021 03:08:56 -0400 (EDT) Received: from smtpin33.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 4D9348249980 for ; Thu, 14 Oct 2021 07:08:56 +0000 (UTC) X-FDA: 78694165872.33.F46F0C1 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf21.hostedemail.com (Postfix) with ESMTP id ED1DED040561 for ; Thu, 14 Oct 2021 07:08:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634195335; h=from:from:reply-to:subject:subject: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=yHUkpl/ZAVHt5/5vUXcZgFhHnix+Qpic85kyWSV9RY8=; b=N1d14Ivm4ZamMBtd1vhzfphNfgo2H7hOcz61WmQbsUAxWKnh1kBinAntuBriB8oaNhAtTJ RfD0JT/jEsU/x9b6z7er3aLpAoiChltWbviXBAXmgyO0qR6Mi9dIy+smMRlc8c4tpSgoPV yLN3F3SIGgeFDhr/eoNfSh0YgqifYhQ= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-478-IByHzUKvNcGkm3Yg67y7vQ-1; Thu, 14 Oct 2021 03:08:53 -0400 X-MC-Unique: IByHzUKvNcGkm3Yg67y7vQ-1 Received: by mail-wr1-f71.google.com with SMTP id y12-20020a056000168c00b00160da4de2c7so3824389wrd.5 for ; Thu, 14 Oct 2021 00:08:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:organization:in-reply-to :content-transfer-encoding; bh=yHUkpl/ZAVHt5/5vUXcZgFhHnix+Qpic85kyWSV9RY8=; b=zvWoL6Kw7537hd8BygIFkd31tiukGKGz2P+MAu7MG0aVOZRVbTPveF/BHz0MaYHUVP FGKfePGMAWRJI2tmJfoP2eDwdokeFAuUtx2SaY+MdPfsI1gDSw8RQzn/Y6+ebod+CVjF LAekVxYwgYSz2mI/9Vdgq1EA++5s4RaBf5HmnseYEYJc0XHCUxy2LX1r0N4mVaS97EF9 YqiuiJUf44139dCzkTl+yWtedmQRy9RA3aJ6ocy2PkcsrpXEJxapwAPbfZZitOuDGg0g 0ks6EaME0zLu7HSOtr+hY7B+6xd2U2pZl8otvRI41GACkd8B+j84pTwQMrEzUMFyQpcm 8aDA== X-Gm-Message-State: AOAM533W6dZGaUKG+OXrEHz+ONNl/Dgb45VdjjOD6o4P+XIYhx7Ztb8p nSX/4fd6NE1//9wLacmtY3ZGy09BlfZ3Wqf2jkGrrapyfcCLtwjQF6yRCgr3R/MexfmxkUY3SST 4CeC5M0mYD6A= X-Received: by 2002:a05:600c:35d4:: with SMTP id r20mr4183469wmq.76.1634195332583; Thu, 14 Oct 2021 00:08:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyKXpfZss+zb/o1WdVupKiRz0sH2zAIcjZtr09k3FEtY75Mtk/BCXaTGY1T9oSwoTebKGf52A== X-Received: by 2002:a05:600c:35d4:: with SMTP id r20mr4183437wmq.76.1634195332260; Thu, 14 Oct 2021 00:08:52 -0700 (PDT) Received: from [192.168.3.132] (p5b0c694e.dip0.t-ipconnect.de. [91.12.105.78]) by smtp.gmail.com with ESMTPSA id r9sm1554409wrn.95.2021.10.14.00.08.51 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 14 Oct 2021 00:08:51 -0700 (PDT) Message-ID: <11ca4abc-efb7-6304-df36-98951915b2e3@redhat.com> Date: Thu, 14 Oct 2021 09:08:50 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.1.0 Subject: Re: [PATCH] mm/migrate: rework hotplug_memory_notifier() stub To: Arnd Bergmann , Andrew Morton , Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Vlastimil Babka , Dave Hansen , Stephen Rothwell Cc: Arnd Bergmann , Michal Hocko , Oscar Salvador , linux-kernel@vger.kernel.org, linux-mm@kvack.org References: <20211013144029.2154629-1-arnd@kernel.org> From: David Hildenbrand Organization: Red Hat In-Reply-To: <20211013144029.2154629-1-arnd@kernel.org> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: ED1DED040561 X-Stat-Signature: c15sg7fpep4xrxcm6owac4dku1xo565n Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=N1d14Ivm; spf=none (imf21.hostedemail.com: domain of david@redhat.com has no SPF policy when checking 170.10.133.124) smtp.mailfrom=david@redhat.com; dmarc=pass (policy=none) header.from=redhat.com X-HE-Tag: 1634195334-110054 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 13.10.21 16:39, Arnd Bergmann wrote: > From: Arnd Bergmann > > The previous change added a compile time warning for the > CONFIG_MEMORY_HOTPLUG=n case: > > mm/migrate.c:3216:22: error: 'migrate_on_reclaim_callback' defined but not used [-Werror=unused-function] > 3216 | static int __meminit migrate_on_reclaim_callback(struct notifier_block *self, > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~ > mm/migrate.c:3197:13: error: 'set_migration_target_nodes' defined but not used [-Werror=unused-function] > 3197 | static void set_migration_target_nodes(void) > | ^~~~~~~~~~~~~~~~~~~~~~~~~~ > > Rework the hotplug_memory_notifier() stub implementation into > an inline function so it always references its argument but > ignores it, leading the compiler to silently drop the hotplug > memory notifier function and further code referenced from it. > > To do this, the #ifdef around those functions need to be removed > as well, but this tends to help with readability and build coverage. > > Fixes: dd3e24b84bc1 ("mm/migrate: add CPU hotplug to demotion #ifdef") > Signed-off-by: Arnd Bergmann > --- > include/linux/memory.h | 5 ++++- > mm/migrate.c | 6 +----- > mm/page_ext.c | 4 +--- > mm/slab.c | 4 ++-- > 4 files changed, 8 insertions(+), 11 deletions(-) > > diff --git a/include/linux/memory.h b/include/linux/memory.h > index a216829df280..95af54f585a1 100644 > --- a/include/linux/memory.h > +++ b/include/linux/memory.h > @@ -125,7 +125,10 @@ static inline int memory_notify(unsigned long val, void *v) > { > return 0; > } > -#define hotplug_memory_notifier(fn, pri) ({ 0; }) > +static inline int hotplug_memory_notifier(notifier_fn_t fn, int pri) > +{ > + return 0; > +} > /* These aren't inline functions due to a GCC bug. */ > #define register_hotmemory_notifier(nb) ({ (void)(nb); 0; }) > #define unregister_hotmemory_notifier(nb) ({ (void)(nb); }) > diff --git a/mm/migrate.c b/mm/migrate.c > index 7769abac8aad..32303d517e10 100644 > --- a/mm/migrate.c > +++ b/mm/migrate.c > @@ -3059,7 +3059,7 @@ void migrate_vma_finalize(struct migrate_vma *migrate) > EXPORT_SYMBOL(migrate_vma_finalize); > #endif /* CONFIG_DEVICE_PRIVATE */ > > -#if defined(CONFIG_MEMORY_HOTPLUG) || defined(CONFIG_HOTPLUG_CPU) > +#if defined(CONFIG_HOTPLUG_CPU) > /* Disable reclaim-based migration. */ > static void __disable_all_migrate_targets(void) > { > @@ -3201,7 +3201,6 @@ static void set_migration_target_nodes(void) > put_online_mems(); > } > > -#if defined(CONFIG_MEMORY_HOTPLUG) > /* > * This leaves migrate-on-reclaim transiently disabled between > * the MEM_GOING_OFFLINE and MEM_OFFLINE events. This runs > @@ -3258,9 +3257,7 @@ static int __meminit migrate_on_reclaim_callback(struct notifier_block *self, > > return notifier_from_errno(0); > } > -#endif /* CONFIG_MEMORY_HOTPLUG */ > > -#ifdef CONFIG_HOTPLUG_CPU > /* > * React to hotplug events that might affect the migration targets > * like events that online or offline NUMA nodes. > @@ -3302,4 +3299,3 @@ static int __init migrate_on_reclaim_init(void) > } > late_initcall(migrate_on_reclaim_init); > #endif /* CONFIG_HOTPLUG_CPU */ > -#endif /* CONFIG_MEMORY_HOTPLUG || CONFIG_HOTPLUG_CPU */ > diff --git a/mm/page_ext.c b/mm/page_ext.c > index 106079e67c2e..6242afb24d84 100644 > --- a/mm/page_ext.c > +++ b/mm/page_ext.c > @@ -269,7 +269,7 @@ static int __meminit init_section_page_ext(unsigned long pfn, int nid) > total_usage += table_size; > return 0; > } > -#ifdef CONFIG_MEMORY_HOTPLUG > + > static void free_page_ext(void *addr) > { > if (is_vmalloc_addr(addr)) { > @@ -374,8 +374,6 @@ static int __meminit page_ext_callback(struct notifier_block *self, > return notifier_from_errno(ret); > } > > -#endif > - > void __init page_ext_init(void) > { > unsigned long pfn; > diff --git a/mm/slab.c b/mm/slab.c > index 01775fe0e002..da132a9ae6f8 100644 > --- a/mm/slab.c > +++ b/mm/slab.c > @@ -1095,7 +1095,7 @@ static int slab_offline_cpu(unsigned int cpu) > return 0; > } > > -#if defined(CONFIG_NUMA) && defined(CONFIG_MEMORY_HOTPLUG) > +#if defined(CONFIG_NUMA) > /* > * Drains freelist for a node on each slab cache, used for memory hot-remove. > * Returns -EBUSY if all objects cannot be drained so that the node is not > @@ -1157,7 +1157,7 @@ static int __meminit slab_memory_callback(struct notifier_block *self, > out: > return notifier_from_errno(ret); > } > -#endif /* CONFIG_NUMA && CONFIG_MEMORY_HOTPLUG */ > +#endif /* CONFIG_NUMA */ > > /* > * swap the static kmem_cache_node with kmalloced memory > Acked-by: David Hildenbrand -- Thanks, David / dhildenb