Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3086725pxj; Mon, 7 Jun 2021 01:45:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwfyweqvwR9zB5VaVfV4hGVpNnyuAlwx9JO3LsHmI1RnpHSvdUCZV6qNSibpMbLmUduQMOU X-Received: by 2002:a05:6402:27c6:: with SMTP id c6mr19039162ede.200.1623055546447; Mon, 07 Jun 2021 01:45:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623055546; cv=none; d=google.com; s=arc-20160816; b=h4bY0et6x7ai2a6KVM3+wTLUxNdH5Psmm5cpyngPf3PQ89M54KfeQHGc4xVhI8QmmE m44JlAAZSnkP9QT/u+DojVLUXQxhs9ZVfBakWivmBZOwN/SODTypw5uwJ5HwSVSKGSgC Zse/8g1LXdBRpw25ZTeqjc9GT7IAfYdRLf15jeWAqkJCNaAYHNIGb20/bZ67QzJB27Ra /5PQV0+9LY4CM60dZMbliG0MivflI5HJ52XVOkVkhULFXzrgOJ/JqpFPT1rHQjPvmKI5 ZRdoK/A8OScTLen/RI0IRbJgb/mXQXzIG990Sxgni88W2K1/GVVFWEqzPTrDJ4pASxWm UVyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=M3F3FHeKDWylfF8W6AMh3TTuaGg9ATjr41pkU+HFOFE=; b=yGRijVIOD0ru26CwLZ2PFT/UR9jeklfbI2I+dSvqyAONMUhdz1PiX91ITkm3qK3kVx O5/5ToXzBNkW7WmQDVJaA5O404we4MHZ07Kh8V/UimocBl1V6BreoA3Ni9dIa1vYALaz Xl4iXA14jzJ7/hvKRdzCfQleg5W6fsjuIKDvONceilrcR1G7FYa6DbaMKq31N4ylxEap MztasvHIhdKBSijQfrzTBHZPIQXMBaJMzDZFl0sAr2I3jOyU7zAil2F3ncimVjCbR4wI CjiUm/tlyN9wrVR2FgIhL200Ut/d/ljnmM5U7lUb1maeEuU3CUsmTf3KPkaZQoFEF8aI v5nQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=RIPGit61; 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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e3si10883465ejm.272.2021.06.07.01.45.24; Mon, 07 Jun 2021 01:45:46 -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.com header.s=susede1 header.b=RIPGit61; 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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230375AbhFGIoF (ORCPT + 99 others); Mon, 7 Jun 2021 04:44:05 -0400 Received: from smtp-out2.suse.de ([195.135.220.29]:38480 "EHLO smtp-out2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229436AbhFGIoE (ORCPT ); Mon, 7 Jun 2021 04:44:04 -0400 Received: from relay2.suse.de (unknown [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 2F6A61FDA5; Mon, 7 Jun 2021 08:42:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1623055333; 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=M3F3FHeKDWylfF8W6AMh3TTuaGg9ATjr41pkU+HFOFE=; b=RIPGit61ezH96kAndMRXb4M5TOkS+gxNEvLG1rSI3+s3MLKdUHScGPSnXEYMwvP9Ks2lpq +6NSYxvxLgcS5HV6Uj+/Cp6cdf3lo8JtV9uZt9SpuJQWJOPwvllrgMImXmf9/hP1GVF946 O7oqNiIOh7DC6WkxcDk009kn2rkW9bc= Received: from suse.cz (unknown [10.100.201.86]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id ED786A3B88; Mon, 7 Jun 2021 08:42:12 +0000 (UTC) Date: Mon, 7 Jun 2021 10:42:12 +0200 From: Michal Hocko To: Oscar Salvador Cc: David Hildenbrand , Andrew Morton , Dave Hansen , Anshuman Khandual , Vlastimil Babka , Pavel Tatashin , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 1/3] mm,page_alloc: Use {get,put}_online_mems() to get stable zone's values Message-ID: References: <20210602091457.17772-1-osalvador@suse.de> <20210602091457.17772-2-osalvador@suse.de> <39473305-6e91-262d-bcc2-76b745a5b14a@redhat.com> <20210604074140.GA25063@linux> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210604074140.GA25063@linux> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri 04-06-21 09:41:45, Oscar Salvador wrote: > On Thu, Jun 03, 2021 at 02:45:13PM +0200, Michal Hocko wrote: [...] > > But the primary question is whether anybody actually cares about > > potential races in the first place. > > I have been checking move_freepages_block() and alloc_contig_pages(), which > are two of the functions that call zone_spans_pfn(). > > move_freepages_block() uses it in a way to align the given pfn to pageblock > top and bottom, and then check that aligned pfns are still within the same zone. > From a memory-hotplug perspective that's ok as we know that we are offlining > PAGES_PER_SECTION (which implies whole pageblocks). > > alloc_contig_pages() (used by the hugetlb gigantic allocator) runs through a > node's zonelist and checks whether zone->zone_start_pfn + nr_pages stays within > the same zone. > IMHO, the race with zone_spans_last_pfn() vs mem-hotplug would not be that bad, > as it will be caught afters by e.g: __alloc_contig_pages when pages cannot be > isolated because they are offline etc. > > So, I would say we do not really need the lock, but I might be missing something. > But if we chose to care about this, then the locking should be done right, not > half-way as it is right now. That is my understanding as well. -- Michal Hocko SUSE Labs