From patchwork Wed Jun 2 09:14:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oscar Salvador X-Patchwork-Id: 12295095 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=-18.8 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, USER_AGENT_GIT 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 C3002C47083 for ; Wed, 2 Jun 2021 15:18:40 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 71C3961246 for ; Wed, 2 Jun 2021 15:18:40 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 71C3961246 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 7C6846B008C; Wed, 2 Jun 2021 11:18:34 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 68E436B0095; Wed, 2 Jun 2021 11:18:34 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 43EFE6B0092; Wed, 2 Jun 2021 11:18:34 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0034.hostedemail.com [216.40.44.34]) by kanga.kvack.org (Postfix) with ESMTP id 1340C6B008C for ; Wed, 2 Jun 2021 11:18:34 -0400 (EDT) Received: from smtpin36.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id B531F180AD804 for ; Wed, 2 Jun 2021 15:18:33 +0000 (UTC) X-FDA: 78209140506.36.5226033 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by imf17.hostedemail.com (Postfix) with ESMTP id 026674202A14 for ; Wed, 2 Jun 2021 15:18:22 +0000 (UTC) Received: from imap.suse.de (imap-alt.suse-dmz.suse.de [192.168.254.47]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 0342333681; Wed, 2 Jun 2021 15:18:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1622647111; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: in-reply-to:in-reply-to:references:references; bh=ATheSSLLZ2P8MhU+2J3xNMWL+VSgOZk/hQ1TADrnaks=; b=RktuDgHxXX9qk0TdyvY443prykckoRzOTLV5fpx5qHhAslfQ66GoKH+CLP3lPtwvAw4Bn0 mZkkJCv87vll6SAugeRnHgmKJlw2BE3pbsjUb0jBfXIjK4isU5LU7MmH/pLrLaNPTm0v5P LMUe0qOZGVOGbOUDLUPOwrrANyw1ABU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1622647111; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: in-reply-to:in-reply-to:references:references; bh=ATheSSLLZ2P8MhU+2J3xNMWL+VSgOZk/hQ1TADrnaks=; b=7EjBXnruDEMEdOxQjQm/Tn5Tis49KJPSFGiDKw14qVt2BiQP15LxUkjvOuom2jClxLmeN1 iYoRysZxnMjcCCAg== Received: by imap.suse.de (Postfix, from userid 51) id F17D511CD7; Wed, 2 Jun 2021 15:28:32 +0000 (UTC) Received: from imap3-int (imap-alt.suse-dmz.suse.de [192.168.254.47]) by imap.suse.de (Postfix) with ESMTP id 041A211D1D; Wed, 2 Jun 2021 09:15:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1622625309; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: in-reply-to:in-reply-to:references:references; bh=ATheSSLLZ2P8MhU+2J3xNMWL+VSgOZk/hQ1TADrnaks=; b=1CSir7kFrq/6l+vnYYjUHflh/ejKn7fulZUuf1vptmstMV3mHI+zop4H0al1+twDnGlbjX NK+5ZvzvN636e6axM/APtEWnvu64ymGnvPNBSQdveo0dnI+kAdTCMD19KlU0+43KeVKtQV V5DQf6ZZ0qL+1TipgvhTMrKU1tZs9ug= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1622625309; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: in-reply-to:in-reply-to:references:references; bh=ATheSSLLZ2P8MhU+2J3xNMWL+VSgOZk/hQ1TADrnaks=; b=7Kx1H8sSjrn2Y7RvWTpNtp4BoNOK9aJkDUQlb47cE031M9Y2elxYflmUMHc51rtyiKlpQV gADk3P5e5YVyNICw== Received: from director2.suse.de ([192.168.254.72]) by imap3-int with ESMTPSA id UCDUOBxMt2A6HgAALh3uQQ (envelope-from ); Wed, 02 Jun 2021 09:15:08 +0000 From: Oscar Salvador To: Andrew Morton Cc: David Hildenbrand , Dave Hansen , Michal Hocko , Anshuman Khandual , Vlastimil Babka , Pavel Tatashin , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Oscar Salvador Subject: [PATCH v2 1/3] mm,page_alloc: Use {get,put}_online_mems() to get stable zone's values Date: Wed, 2 Jun 2021 11:14:55 +0200 Message-Id: <20210602091457.17772-2-osalvador@suse.de> X-Mailer: git-send-email 2.13.7 In-Reply-To: <20210602091457.17772-1-osalvador@suse.de> References: <20210602091457.17772-1-osalvador@suse.de> Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=RktuDgHx; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=7EjBXnru; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=1CSir7kF; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=7Kx1H8sS; spf=pass (imf17.hostedemail.com: domain of osalvador@suse.de designates 195.135.220.28 as permitted sender) smtp.mailfrom=osalvador@suse.de; dmarc=none X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 026674202A14 X-Stat-Signature: 1p8qxbgtoep85t7tfpxf1trhyxgy8wid X-HE-Tag: 1622647102-827160 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: Currently, page_outside_zone_boundaries() takes zone's span_seqlock when reading zone_start_pfn and spanned_pages so those values are stable vs memory hotplug operations. move_pfn_range_to_zone() and remove_pfn_range_from_zone(), which are the functions that can change zone's values are serialized by mem_hotplug_lock by mem_hotplug_{begin,done}, so we can just use {get,put}_online_mems() on the readers. This will allow us to completely kill span_seqlock lock as no users will remain after this series. Signed-off-by: Oscar Salvador Reported-by: kernel test robot --- mm/page_alloc.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index aaa1655cf682..296cb00802b4 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -582,17 +582,15 @@ void set_pageblock_migratetype(struct page *page, int migratetype) static int page_outside_zone_boundaries(struct zone *zone, struct page *page) { int ret = 0; - unsigned seq; unsigned long pfn = page_to_pfn(page); unsigned long sp, start_pfn; - do { - seq = zone_span_seqbegin(zone); - start_pfn = zone->zone_start_pfn; - sp = zone->spanned_pages; - if (!zone_spans_pfn(zone, pfn)) - ret = 1; - } while (zone_span_seqretry(zone, seq)); + get_online_mems(); + start_pfn = zone->zone_start_pfn; + sp = zone->spanned_pages; + if (!zone_spans_pfn(zone, pfn)) + ret = 1; + put_online_mems(); if (ret) pr_err("page 0x%lx outside node %d zone %s [ 0x%lx - 0x%lx ]\n",