Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3140086pxj; Mon, 7 Jun 2021 03:25:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJym9aXUuvKb4umpOepPr38mjiuCu7ZDmnDsAoyBsA7E6BoZhuIY+75khbdWNx6WX539w9qV X-Received: by 2002:a17:906:4109:: with SMTP id j9mr17633095ejk.250.1623061513766; Mon, 07 Jun 2021 03:25:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623061513; cv=none; d=google.com; s=arc-20160816; b=r3zrNatWgpEcPBu+Skogwr/ZZP3yj4FncRUzH6EqvN96xCIGACdMtv1pqrdr7vUtS4 kjRbiEbFpF0j1D3Sd1sz8O49JapTAYTh/8vXBPtPX/7sVvixmWNEa3PSPOgdPB5JyWs7 AsLizF+CEYU8mJE9Wye9awNd0E6vduqAk8iFck6RvUYneMeiNb4jkI1296uLWsTreQ3D LxohgNyI6P6ELlRzYqrayx3GimS42ZmcYe3h7UyR9W/4gq4NQXTvmI23koKv26BI4eGJ FKCv8I/XwkeM6IoOqTOFfRRQZVb2H1WjB4uJoP0DOCCgTvq7GKkMPiC4L1OyuNEbh+Cd HfAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature:dkim-signature:dkim-signature:dkim-signature; bh=3yTVmuXnYhofXBlCbo4IT8YVBm6HcKA8wUzVzSayMos=; b=T1BcfD0jZau9R2ClKlMoh6BOVmGNGQd2uMVMYK3+CUPWRHIsixGX2O/pDICiQxgqka KINOJPqcOKcpsgAKZTACxckCptxIRQ57roJ73cmZToEZie96xnHmP23BBxWkkHs+7YG9 f3s40DUJMjDGdlNEva94A941VCHgy5Dxs7RuHpDx9VD84N6hCgvMQvahV5g4sQncM7B/ gai0JRIEoe+dOmnJ4clkmxHgUD0lJBdWzH+H2TuCEuHVU9L/eaO/x279YQgfI0WTOoAD ntu153cVxN5mS1754YolxAyoQSC4fl3XaQo76dO+IQB9qLvPK0PiL6iVQFvosoKo+P2d GgnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=WzFfC+Wg; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=aoUH1FPn; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=WzFfC+Wg; dkim=neutral (no key) header.i=@suse.de header.b=aoUH1FPn; 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 p20si10824243ejn.446.2021.06.07.03.24.51; Mon, 07 Jun 2021 03:25:13 -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=WzFfC+Wg; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=aoUH1FPn; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=WzFfC+Wg; dkim=neutral (no key) header.i=@suse.de header.b=aoUH1FPn; 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 S230389AbhFGKZX (ORCPT + 99 others); Mon, 7 Jun 2021 06:25:23 -0400 Received: from smtp-out2.suse.de ([195.135.220.29]:47808 "EHLO smtp-out2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230097AbhFGKZV (ORCPT ); Mon, 7 Jun 2021 06:25:21 -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-out2.suse.de (Postfix) with ESMTPS id ED35E1FDA5; Mon, 7 Jun 2021 10:23:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1623061407; 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=3yTVmuXnYhofXBlCbo4IT8YVBm6HcKA8wUzVzSayMos=; b=WzFfC+Wgz7EnMtRD06x4fPqve4Fc88iJSnKAXQcb7EnFrMdFTGTGsiwLavkHVSaRziNCC1 KOEReCqMtueednd86PjVL2UNHo+0u6vS2nSl/yflhcvDpxdE9fMEiT73GFJ8xnGVir6Fn2 jYxAw7LfE8zDDShj3W8EwUpsRxB5Cr8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1623061407; 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=3yTVmuXnYhofXBlCbo4IT8YVBm6HcKA8wUzVzSayMos=; b=aoUH1FPnrcaW8PlQgRV9SfiN0ykK3H1waLliOZoBU+6SYnL4wGcL+HKsSSGu59S1RV0PuO jDptSuhc8e/WcgDA== Received: from imap3-int (imap-alt.suse-dmz.suse.de [192.168.254.47]) by imap.suse.de (Postfix) with ESMTP id 4EA63118DD; Mon, 7 Jun 2021 10:23:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1623061407; 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=3yTVmuXnYhofXBlCbo4IT8YVBm6HcKA8wUzVzSayMos=; b=WzFfC+Wgz7EnMtRD06x4fPqve4Fc88iJSnKAXQcb7EnFrMdFTGTGsiwLavkHVSaRziNCC1 KOEReCqMtueednd86PjVL2UNHo+0u6vS2nSl/yflhcvDpxdE9fMEiT73GFJ8xnGVir6Fn2 jYxAw7LfE8zDDShj3W8EwUpsRxB5Cr8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1623061407; 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=3yTVmuXnYhofXBlCbo4IT8YVBm6HcKA8wUzVzSayMos=; b=aoUH1FPnrcaW8PlQgRV9SfiN0ykK3H1waLliOZoBU+6SYnL4wGcL+HKsSSGu59S1RV0PuO jDptSuhc8e/WcgDA== Received: from director2.suse.de ([192.168.254.72]) by imap3-int with ESMTPSA id d7jdD5/zvWC2MgAALh3uQQ (envelope-from ); Mon, 07 Jun 2021 10:23:27 +0000 Date: Mon, 7 Jun 2021 12:23:25 +0200 From: Oscar Salvador To: David Hildenbrand Cc: Michal Hocko , 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: <20210607102318.GA12683@linux> References: <20210602091457.17772-1-osalvador@suse.de> <20210602091457.17772-2-osalvador@suse.de> <39473305-6e91-262d-bcc2-76b745a5b14a@redhat.com> <20210604074140.GA25063@linux> <20210607075147.GA10554@linux> <85984701-55ae-dfa5-2a8d-f637051b612d@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <85984701-55ae-dfa5-2a8d-f637051b612d@redhat.com> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 07, 2021 at 10:49:01AM +0200, David Hildenbrand wrote: > I'd like to point out that I think the seqlock is not in place to > synchronize with actual growing/shrinking but to get consistent zone ranges > -- like using atomics, but we have two inter-dependent values here. I guess so, at least that's what it should do. But the way it is placed right now is misleading. If we really want to get consistent zone ranges, we should start using zone's seqlock where it matters and that is pretty much all those places that use zone_spans_pfn(). Otherwise there is no way you can be sure the pfn you're checking is within the limits. Moreover, as Michal pointed out early, if we really want to go down that road the locking should be made in the caller evolving the operation, otheriwse things might change once the lock is dropped and you're working with a wrong assumption. I can see arguments for both riping it out and doing it right (but none for the way it is right now). For riping it out, one could say that those races might not be fatal, as usually the pfn you're working with (the one you want to check falls within a certain range) you know is valid, so the worst can happen is you get false positives/negatives and that might or might not be detected further down. How bad are false positive/negatives I guess it depends on the situation, but we already do that right now. The zone_spans_pfn() from page_outside_zone_boundaries() is the only one using locking right now, so well, if we survided this long without locks in other places using zone_spans_pfn() makes one wonder if it is that bad. On the other hand, one could argue that for correctness sake, we should be holding zone's seqlock whenever checking for zone_spans_pfn() to avoid any inconsistency. -- Oscar Salvador SUSE L3