Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp663835pxj; Wed, 2 Jun 2021 08:23:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx2m3RbBIWx67c/eX9bUNwt0YkmlO4dLlmajaxZpm6RviidRN2kVaIi1sBBBsJrzH9cN6l5 X-Received: by 2002:a17:906:b748:: with SMTP id fx8mr26066961ejb.477.1622647423253; Wed, 02 Jun 2021 08:23:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622647423; cv=none; d=google.com; s=arc-20160816; b=Wxaz7Ymy9/a1D7B6JOPJKukKtGpbmVLNrcdL6TRERJ4lMxu3deWthxjbanOkdsehD5 l6wTo5U1oRDdyOUGzaHJxcEp/IuOvx9swhaDvjw/wCd79gZtjcg8Adrj77/W1vTdPfub Cq2Pm6/wm7FvBkDywbHxlyw+REk3jdA3bGYuKf+nYsbTuj2B9nKx41XIfNSFBe8Uxv+R jMyngia5wsL1pgPbMmya/PYzjUwGOvNPZ1jWZsh8he/+c15HvvCpfrO8gam56iP5m1V/ seNBLGhXSr5TQixpD3wPY96MwI22c2ZRS3+pcGL0t/WLd3/N6wow3ybRKYTsY/JcQNWN H4ow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dkim-signature:dkim-signature:dkim-signature :dkim-signature; bh=ATheSSLLZ2P8MhU+2J3xNMWL+VSgOZk/hQ1TADrnaks=; b=a1nuzFPNJCiwyU9n4jvycqEFSFW2zcuy0H6bdNGAxUSMhxA/yLN7rN4MkxuGIMkVaz yUidL9y+WvuwlAtsIeZ3qJpMYG6rint2cgEXFR5ma8qABZCk3l0HDeTHKxiavwCtx39Y hH47sr25vqyO5fhGFET5IiOcz3NtvuQIxzoNbjaL00JNMOjzt1M7Y2CAkeiGUMdcYzIf u13Dxh8fHYtsbsER5LddPWd/gvJMwCUuZFVZ9YUoVm+0Tf5E8oIBuY/ILW8CeMZRmc+B ASfby1HG9lasomEv9cdVVvaxG1ojJ0rxq+enn1uJUxd8kU8ZCUlXTJIXSs9SeWPpS4k2 685g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=RktuDgHx; dkim=neutral (no key) header.i=@suse.de; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=1CSir7kF; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id qw11si64432ejb.688.2021.06.02.08.23.20; Wed, 02 Jun 2021 08:23:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=RktuDgHx; dkim=neutral (no key) header.i=@suse.de; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=1CSir7kF; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232421AbhFBPUz (ORCPT + 99 others); Wed, 2 Jun 2021 11:20:55 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]:32782 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232241AbhFBPUP (ORCPT ); Wed, 2 Jun 2021 11:20:15 -0400 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> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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", -- 2.16.3