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.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,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 48028C433B4 for ; Mon, 12 Apr 2021 12:40:23 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id C4B8561263 for ; Mon, 12 Apr 2021 12:40:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C4B8561263 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 3D6D66B006C; Mon, 12 Apr 2021 08:40:22 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3866F6B006E; Mon, 12 Apr 2021 08:40:22 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2274C6B0070; Mon, 12 Apr 2021 08:40:22 -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 034D96B006C for ; Mon, 12 Apr 2021 08:40:21 -0400 (EDT) Received: from smtpin14.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id AFE088248D7C for ; Mon, 12 Apr 2021 12:40:21 +0000 (UTC) X-FDA: 78023673042.14.3990877 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf09.hostedemail.com (Postfix) with ESMTP id 2D5D26000117 for ; Mon, 12 Apr 2021 12:40:18 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 976F3AC6A; Mon, 12 Apr 2021 12:40:19 +0000 (UTC) To: Mel Gorman , Andrew Morton Cc: Oscar Salvador , "Michael S. Tsirkin" , Alexander Duyck , Minchan Kim , Michal Hocko , David Hildenbrand , Linux-MM , LKML References: <20210412120842.GY3697@techsingularity.net> From: Vlastimil Babka Subject: Re: [PATCH v2 resend] mm/memory_hotplug: Make unpopulated zones PCP structures unreachable during hot remove Message-ID: Date: Mon, 12 Apr 2021 14:40:18 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: <20210412120842.GY3697@techsingularity.net> Content-Type: text/plain; charset=iso-8859-15 Content-Language: en-US X-Rspamd-Queue-Id: 2D5D26000117 X-Stat-Signature: gb9za6kp6cf7eeycnsqidcggxcaqu78t X-Rspamd-Server: rspam02 Received-SPF: none (suse.cz>: No applicable sender policy available) receiver=imf09; identity=mailfrom; envelope-from=""; helo=mx2.suse.de; client-ip=195.135.220.15 X-HE-DKIM-Result: none/none X-HE-Tag: 1618231218-801050 Content-Transfer-Encoding: quoted-printable 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 4/12/21 2:08 PM, 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. >=20 > This patch deletes IRQ disable/enable on the grounds that IRQs protect > nothing and assumes the existing hotplug paths guarantees the PCP canno= t be > used after zone_pcp_enable(). That should be the case already because a= ll > the pages have been freed and there is no page to put on the PCP lists. >=20 > Signed-off-by: Mel Gorman Yeah the irq disabling here is clearly bogus, so: Acked-by: Vlastimil Babka But I think Michal has a point that we might best leave the pagesets arou= nd, by a future change. I'm have some doubts that even with your reordering of t= he reset/destroy after zonelist rebuild in v1 they cant't be reachable. We h= ave no protection between zonelist rebuild and zonelist traversal, and that's wh= y we just leave pgdats around. So I can imagine a task racing with memory hotremove might see watermarks= as ok in get_page_from_freelist() for the zone and proceeds to try_this_zone:, = then gets stalled/scheduled out while hotremove rebuilds the zonelist and dest= roys the pcplists, then the first task is resumed and proceeds with rmqueue_pc= plist(). So that's very rare thus not urgent, and this patch doesn't make it less = rare so not a reason to block it. > --- > Resending for email address correction and adding lists >=20 > Changelog since v1 > o Minimal fix >=20 > mm/page_alloc.c | 4 ---- > 1 file changed, 4 deletions(-) >=20 > 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) > =20 > void zone_pcp_reset(struct zone *zone) > { > - unsigned long flags; > int cpu; > struct per_cpu_pageset *pset; > =20 > - /* avoid races with drain_pages() */ > - local_irq_save(flags); > if (zone->pageset !=3D &boot_pageset) { > for_each_online_cpu(cpu) { > pset =3D per_cpu_ptr(zone->pageset, cpu); > @@ -8966,7 +8963,6 @@ void zone_pcp_reset(struct zone *zone) > free_percpu(zone->pageset); > zone->pageset =3D &boot_pageset; > } > - local_irq_restore(flags); > } > =20 > #ifdef CONFIG_MEMORY_HOTREMOVE >=20