From patchwork Mon Apr 12 12:08:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mel Gorman X-Patchwork-Id: 12197865 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.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,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 82E31C433B4 for ; Mon, 12 Apr 2021 12:08:47 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 2678E61029 for ; Mon, 12 Apr 2021 12:08:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2678E61029 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=techsingularity.net Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id A62F56B0036; Mon, 12 Apr 2021 08:08:46 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A132D6B006C; Mon, 12 Apr 2021 08:08:46 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8DABC6B006E; Mon, 12 Apr 2021 08:08:46 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0115.hostedemail.com [216.40.44.115]) by kanga.kvack.org (Postfix) with ESMTP id 6E90F6B0036 for ; Mon, 12 Apr 2021 08:08:46 -0400 (EDT) Received: from smtpin36.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 1BF434DA2 for ; Mon, 12 Apr 2021 12:08:46 +0000 (UTC) X-FDA: 78023593452.36.9515892 Received: from outbound-smtp01.blacknight.com (outbound-smtp01.blacknight.com [81.17.249.7]) by imf29.hostedemail.com (Postfix) with ESMTP id DC0913CC for ; Mon, 12 Apr 2021 12:08:43 +0000 (UTC) Received: from mail.blacknight.com (pemlinmail01.blacknight.ie [81.17.254.10]) by outbound-smtp01.blacknight.com (Postfix) with ESMTPS id 4ABC6C4A61 for ; Mon, 12 Apr 2021 13:08:44 +0100 (IST) Received: (qmail 2610 invoked from network); 12 Apr 2021 12:08:44 -0000 Received: from unknown (HELO techsingularity.net) (mgorman@techsingularity.net@[84.203.22.4]) by 81.17.254.9 with ESMTPSA (AES256-SHA encrypted, authenticated); 12 Apr 2021 12:08:44 -0000 Date: Mon, 12 Apr 2021 13:08:42 +0100 From: Mel Gorman To: Andrew Morton Cc: Oscar Salvador , "Michael S. Tsirkin" , Vlastimil Babka , Alexander Duyck , Minchan Kim , Michal Hocko , David Hildenbrand , Linux-MM , LKML Subject: [PATCH v2 resend] mm/memory_hotplug: Make unpopulated zones PCP structures unreachable during hot remove Message-ID: <20210412120842.GY3697@techsingularity.net> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) X-Stat-Signature: 8chgiszbicoijy7wfudzs5rxugeg3z56 X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: DC0913CC Received-SPF: none (techsingularity.net>: No applicable sender policy available) receiver=imf29; identity=mailfrom; envelope-from=""; helo=outbound-smtp01.blacknight.com; client-ip=81.17.249.7 X-HE-DKIM-Result: none/none X-HE-Tag: 1618229323-855196 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: 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. Signed-off-by: Mel Gorman Reviewed-by: David Hildenbrand Acked-by: Vlastimil Babka Acked-by: Michal Hocko Reviewed-by: Oscar Salvador --- 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