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=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 B0C4BC433ED for ; Tue, 13 Apr 2021 06:40:34 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 40816613A9 for ; Tue, 13 Apr 2021 06:40:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 40816613A9 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id B9C9F6B0036; Tue, 13 Apr 2021 02:40:33 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B4CBC6B006E; Tue, 13 Apr 2021 02:40:33 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A14EF6B0070; Tue, 13 Apr 2021 02:40:33 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0126.hostedemail.com [216.40.44.126]) by kanga.kvack.org (Postfix) with ESMTP id 85E836B0036 for ; Tue, 13 Apr 2021 02:40:33 -0400 (EDT) Received: from smtpin03.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 3083318087374 for ; Tue, 13 Apr 2021 06:40:33 +0000 (UTC) X-FDA: 78026395146.03.88E10A2 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf21.hostedemail.com (Postfix) with ESMTP id 068CCE000119 for ; Tue, 13 Apr 2021 06:40:30 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1618296031; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=BbGxV0ae0JhOJ49pcOvtfZGV+l+VQAXuXZ/ER034yk8=; b=lohbHlsQlwbPpTIeX3QI09J6856iE5bloOlCNzJ62j+5NYb/Ii1AmBZVY6NxtOQw8flQvt NkNeRuUQn1M4YdnnXhHihINGMrAOnZJPo4+DIJpaE8JDFckUyGIPg2TRQlNLDuKTcKEgv+ mWjR6gN86unSSjQT4LCOAzkpIyG+E4I= Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 5B90CAF0F; Tue, 13 Apr 2021 06:40:31 +0000 (UTC) Date: Tue, 13 Apr 2021 08:40:30 +0200 From: Michal Hocko To: Mel Gorman Cc: Andrew Morton , Oscar Salvador , "Michael S. Tsirkin" , Vlastimil Babka , Alexander Duyck , Minchan Kim , David Hildenbrand , Linux-MM , LKML Subject: Re: [PATCH v2 resend] mm/memory_hotplug: Make unpopulated zones PCP structures unreachable during hot remove Message-ID: References: <20210412120842.GY3697@techsingularity.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210412120842.GY3697@techsingularity.net> X-Rspamd-Queue-Id: 068CCE000119 X-Stat-Signature: 7g5upjz95dhqrai9uymgexf4ju5m7gkp X-Rspamd-Server: rspam02 Received-SPF: none (suse.com>: No applicable sender policy available) receiver=imf21; identity=mailfrom; envelope-from=""; helo=mx2.suse.de; client-ip=195.135.220.15 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1618296030-240411 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 Mon 12-04-21 13:08:42, Mel Gorman wrote: > zone_pcp_reset allegedly protects against a race with drain_pages > using local_irq_save but this is bogus. local_irq_save only operates > on the local CPU. If memory hotplug is running on CPU A and drain_pages > is running on CPU B, disabling IRQs on CPU A does not affect CPU B and > offers no protection. > > This patch deletes IRQ disable/enable on the grounds that IRQs protect > nothing and assumes the existing hotplug paths guarantees the PCP cannot be > used after zone_pcp_enable(). That should be the case already because all > the pages have been freed and there is no page to put on the PCP lists. Yes, that is the case since ec6e8c7e0314 ("mm, page_alloc: disable pcplists during memory offline"). Prior to this commit the behavior was undefined but full zone/node hotremove is rare enough that an existing race was likely never observed. Acked-by: Michal Hocko Thanks! > Signed-off-by: Mel Gorman > --- > Resending for email address correction and adding lists > > Changelog since v1 > o Minimal fix > > mm/page_alloc.c | 4 ---- > 1 file changed, 4 deletions(-) > > diff --git a/mm/page_alloc.c b/mm/page_alloc.c > index 5e8aedb64b57..9bf0db982f14 100644 > --- a/mm/page_alloc.c > +++ b/mm/page_alloc.c > @@ -8952,12 +8952,9 @@ void zone_pcp_enable(struct zone *zone) > > void zone_pcp_reset(struct zone *zone) > { > - unsigned long flags; > int cpu; > struct per_cpu_pageset *pset; > > - /* avoid races with drain_pages() */ > - local_irq_save(flags); > if (zone->pageset != &boot_pageset) { > for_each_online_cpu(cpu) { > pset = per_cpu_ptr(zone->pageset, cpu); > @@ -8966,7 +8963,6 @@ void zone_pcp_reset(struct zone *zone) > free_percpu(zone->pageset); > zone->pageset = &boot_pageset; > } > - local_irq_restore(flags); > } > > #ifdef CONFIG_MEMORY_HOTREMOVE -- Michal Hocko SUSE Labs