Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp622402ybg; Fri, 12 Jun 2020 10:07:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzujOI1vdpr1ek83jeVpjPEsDPzIn2GbqMoKdiqqRprjTfHQjb9bcutECoQ6Fe/EYvAQDWP X-Received: by 2002:a17:906:3441:: with SMTP id d1mr1565990ejb.489.1591981653506; Fri, 12 Jun 2020 10:07:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591981653; cv=none; d=google.com; s=arc-20160816; b=mZ3OPL9CouOVXO7O5l/P8XPQZxTCsQrpIOKgjCp3EG0o4kM+Rc8PYcMc6vSlZ2ldBM CST5C6ig9gQW+vAt1Zz6aThBAt6r6xw5vLKCD9K9UFGzC6EXk86tNa+VGmG60XUgWmvP itB7TZKx6OBa5m8bBBF2wLLAAIlp8+BFBC89025lPZGCGTUY11fXa61y2zebgdY7Z7zN +tXg4/O1ismFlx25UVakiM+LhzP5u5X178vz5FUtsEAX3PrHWVHrz8u5fcZB5CdoSUsD tGB0z3eM0u9xZc81ci6FeFfzFhBvGlc7BRWQGijyeBIewjfIXIUn/0JdtgDoL+7md+4H i2jQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=eH+3QDhRNyDcKL/KipGJBQj7aei9jFTTxrxA/DvT+Co=; b=KO/M21dFgQKhwGfR2C2MCndEgvFOvdwpIixpZyKrZVNeHDwi2KRfTVOGtEKOw2uokd GtnxhoknuNUaBh/d6P3eiPpcPXeKpbIbH7ZsssGadu3KVbfQ5IMRlaT7xcOTRR30l8b5 4FK2W+5FCr79feBakyZk65R1MUKQs1m4yfNIP0WMC8gF7KJWTXv+d8gxmKjhprSKfaoh eiP2x6ruqGaI0ni1Q7+pNYobUOjY96daekLGpezRVWyU4h5aUrKWQaKZFZ0EqHpP+9z9 Aes12OZAgtdz3K0SXl9FQBPxODLCMkEUYA5/nMQnRvpi+AmqK0RiIJxjnK5rVq1vtzDq t+TQ== ARC-Authentication-Results: i=1; mx.google.com; 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 i18si4356497ejx.488.2020.06.12.10.07.09; Fri, 12 Jun 2020 10:07:33 -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; 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 S1726535AbgFLREB (ORCPT + 99 others); Fri, 12 Jun 2020 13:04:01 -0400 Received: from mx2.suse.de ([195.135.220.15]:41048 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726521AbgFLREA (ORCPT ); Fri, 12 Jun 2020 13:04:00 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 7629CAECE; Fri, 12 Jun 2020 17:04:01 +0000 (UTC) Date: Fri, 12 Jun 2020 19:03:52 +0200 From: Michal =?iso-8859-1?Q?Koutn=FD?= To: Andrew Morton Cc: Chris Down , Johannes Weiner , Tejun Heo , Roman Gushchin , linux-mm@kvack.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@fb.com Subject: Re: [PATCH 3/6] mm, memcg: Prevent memory.low load/store tearing Message-ID: <20200612170352.GA40768@blackbook> References: <448206f44b0fa7be9dad2ca2601d2bcb2c0b7844.1584034301.git.chris@chrisdown.name> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="6TrnltStXW4iwmi0" Content-Disposition: inline In-Reply-To: <448206f44b0fa7be9dad2ca2601d2bcb2c0b7844.1584034301.git.chris@chrisdown.name> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --6TrnltStXW4iwmi0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hello. I see suspicious asymmetry, in the current mainline: > WRITE_ONCE(memcg->memory.emin, effective_protection(usage, parent_usage, > READ_ONCE(memcg->memory.min), > READ_ONCE(parent->memory.emin), > atomic_long_read(&parent->memory.children_min_usage))); > > WRITE_ONCE(memcg->memory.elow, effective_protection(usage, parent_usage, > memcg->memory.low, READ_ONCE(parent->memory.elow), > atomic_long_read(&parent->memory.children_low_usage))); On Thu, Mar 12, 2020 at 05:33:01PM +0000, Chris Down = wrote: > diff --git a/mm/memcontrol.c b/mm/memcontrol.c > index aca2964ea494..c85a304fa4a1 100644 > --- a/mm/memcontrol.c > +++ b/mm/memcontrol.c > @@ -6262,7 +6262,7 @@ enum mem_cgroup_protection mem_cgroup_protected(str= uct mem_cgroup *root, > return MEMCG_PROT_NONE; > =20 > emin =3D memcg->memory.min; > - elow =3D memcg->memory.low; > + elow =3D READ_ONCE(memcg->memory.low); > =20 > parent =3D parent_mem_cgroup(memcg); > /* No parent means a non-hierarchical mode on v1 memcg */ > @@ -6291,7 +6291,7 @@ enum mem_cgroup_protection mem_cgroup_protected(str= uct mem_cgroup *root, > if (elow && parent_elow) { > unsigned long low_usage, siblings_low_usage; > =20 > - low_usage =3D min(usage, memcg->memory.low); > + low_usage =3D min(usage, READ_ONCE(memcg->memory.low)); > siblings_low_usage =3D atomic_long_read( > &parent->memory.children_low_usage); Is it possible that these hunks were lost during rebase/merge? IMHO it should apply as: -- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -6428,7 +6428,8 @@ enum mem_cgroup_protection mem_cgroup_protected(struc= t mem_cgroup *root, atomic_long_read(&parent->memory.children_min_usage= ))); WRITE_ONCE(memcg->memory.elow, effective_protection(usage, parent_u= sage, - memcg->memory.low, READ_ONCE(parent->memory.elow), + READ_ONCE(memcg->memory.low), + READ_ONCE(parent->memory.elow), atomic_long_read(&parent->memory.children_low_usage= ))); out: Michal --6TrnltStXW4iwmi0 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEEoQaUCWq8F2Id1tNia1+riC5qSgFAl7jtXIACgkQia1+riC5 qSjUig//d3bjL+7mCpm6speHzN1vPZbVuEsBjl+P4DhMwGSl1iiwWP8chYdm30Xg 5l8eACsZox2Zta2TvNkqUKaYSanJ3+cY4j6vFecnJ2ADRwTG5OgKJHz4pPpTSDox 9YVzYsOzLVF/cfoOiD2GPer+YBaEMyppaqWwfzAb2XoKUmdHsY1A/nBllvbTSm6c zbGdMqb3kt/ixm8cljE/0Wyk26QeyydHBQuU9XW1VQZniQhDWwi4tR7lfFCxMYtQ 9/PUKtgmZ+ku8YOEoc9twXbOxR8C3MZo7zZslrcVvqrF1bVOkpYAZMIMGnSLFf9Q Mdcmbf81yPWEd/7hRO8vC8ICfBnU1nN14f1+MuXt56VWtmLnn/UqJ5sS3vqF5tgV iBlucq9xjxMKsvoT15tNq3DX+CKL5bdqAOglSmT/XwUW1hsVycQ0spCWQ5J4K/bQ ljahv3T9G4UgGouUwrVTZxU2+JC7YQg5BqJoC4sf0hLdFcVjdcq/aQis4b8TZLVs 36wBd/QpHGVEh1bZ5LN2AcFY+WhahNswJjM2rx2WB1S9IMhukeIe2C/PjpKnc2Zw ff7+GBkyif/+0Xwj7N+aXSsLQ/0Xjv3kgcbOXGU0jjdoEpQxyOVtb8mAKGDRHt1D hIr7XNHBIOUgzGC+YBl0fGDVYCWXEg45umFPdf6OTx8MCONUjQI= =Uooi -----END PGP SIGNATURE----- --6TrnltStXW4iwmi0--