Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp3480182rwa; Tue, 23 Aug 2022 05:34:13 -0700 (PDT) X-Google-Smtp-Source: AA6agR5UvDxukpev/bFnH2fGa1AHkQl10E3Ly55mHIF6+Fe4/zXVcZSvbRT/uwaTatdIAM+bfrdz X-Received: by 2002:a17:906:cc14:b0:73d:6749:a33d with SMTP id ml20-20020a170906cc1400b0073d6749a33dmr10468692ejb.707.1661258053284; Tue, 23 Aug 2022 05:34:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661258053; cv=none; d=google.com; s=arc-20160816; b=uyOaRoZqI2I1sv4CDcYmtJum/HqBSoZjnsvhsveVgaj480HTDxvI4fgxMMwgPGcICk kSdh1pDMpp+WTKHrNjwmfSuHK28eX5y4XaHtfM2Pn8/Grlom5XH2jtYcpg/UCz1OeoTx qMS7i1iFP+7s5KUwqWMS5acuQVS/jqkDoHD0lM8cOSorTRqyUO/P5zsuc1P9utztKMMj 0g3+sWxt23Px6V62ebogb142uNpDnHlgmAHgjSKEXlBRC3Mi/8sYtZDGB4HJDyx0rfYc 858ewgVK0ieO8zbX2p8O5RV2d/3DPMPNHE/kO4T8x/R0h5P2mvU2i0h/BJE6PVWdZmq9 sJaA== 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=a5e+aBtB4V09GgYckhU7qkp/jydUu2L/ktWuXDsvUUg=; b=yg/er2lWVCoL/Q2yoHWqw6rfuu4/LFtIKkPBUsAbiS1tuhAARCxdZ0xv/qdqSbFHlZ O1LuM5W2yddjT9960OGpmEH+if+7nCuyGq7pl0rhRHO9oO9eUMkewn9Nwo8yBNWNfB6O B4okAgEDEYQtnlnEGS8S2iC1hO7D5UlgdhhW+3mHjIWnVa/XdIY53qH09OAkiPIcdUsa Nr4NFJ1BhgoXZzt/6zaQ/b9b1v/4qBJilCpKmDKKmy+hGZmY44L0IuGNJ/mPujlQcoJ7 lF7inu++jwoTGoIAweD3GZAO2JkIiG7xb7cvo9982k4QwrH63LctE7T9Gg02U7bOQ0jK RZHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=OKRFeR44; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gb30-20020a170907961e00b0073da2e0af52si1017892ejc.1008.2022.08.23.05.33.46; Tue, 23 Aug 2022 05:34:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=OKRFeR44; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243707AbiHWMYE (ORCPT + 99 others); Tue, 23 Aug 2022 08:24:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58440 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243684AbiHWMUI (ORCPT ); Tue, 23 Aug 2022 08:20:08 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 14213EF9D8; Tue, 23 Aug 2022 02:42:52 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 5202D34299; Tue, 23 Aug 2022 09:42:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1661247748; 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=a5e+aBtB4V09GgYckhU7qkp/jydUu2L/ktWuXDsvUUg=; b=OKRFeR44shGwU0EljaE1Yk98KkScecHFvhrQ5yejUOssX5zl4uJX8SMi15/0k+AdOOx/Il 1MMu5RDHls3J7toCCAhfVHlseTgH3LpppxNutvATRuchyb5zxA1BYToFrVbXH0DgMKUqVQ G28kJ+yPjCDh98TnptwlS13a3X6saZw= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 3FA8313AB7; Tue, 23 Aug 2022 09:42:28 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id x1afDgShBGP9eQAAMHmgww (envelope-from ); Tue, 23 Aug 2022 09:42:28 +0000 Date: Tue, 23 Aug 2022 11:42:27 +0200 From: Michal Hocko To: Shakeel Butt Cc: Johannes Weiner , Roman Gushchin , Muchun Song , Michal =?iso-8859-1?Q?Koutn=FD?= , Eric Dumazet , Soheil Hassas Yeganeh , Feng Tang , Oliver Sang , Andrew Morton , lkp@lists.01.org, Cgroups , Linux MM , netdev , LKML Subject: Re: [PATCH 1/3] mm: page_counter: remove unneeded atomic ops for low/min Message-ID: References: <20220822001737.4120417-1-shakeelb@google.com> <20220822001737.4120417-2-shakeelb@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon 22-08-22 17:20:02, Michal Hocko wrote: > On Mon 22-08-22 07:55:58, Shakeel Butt wrote: > > On Mon, Aug 22, 2022 at 3:18 AM Michal Hocko wrote: [...] > > > Unless I have missed anything this shouldn't break the correctness but I > > > still have to think about the proportional distribution of the > > > protection because that adds to the complexity here. > > > > The patch is not changing any semantics. It is just removing an > > unnecessary atomic xchg() for a specific scenario (min > 0 && min < > > usage). I don't think there will be any change related to proportional > > distribution of the protection. > > Yes, I suspect you are right. I just remembered previous fixes > like 503970e42325 ("mm: memcontrol: fix memory.low proportional > distribution") which just made me nervous that this is a tricky area. > > I will have another look tomorrow with a fresh brain and send an ack. I cannot spot any problem. But I guess it would be good to have a little comment to explain that races on the min_usage update (mentioned by Roman) are acceptable and savings from atomic update are preferred. The worst case I can imagine would be something like uncharge 4kB racing with charge 2MB. The first reduces the protection (min_usage) while the other one misses that update and doesn't increase it. But even then the effect shouldn't be really large. At least I have hard time imagine this would throw things off too much. -- Michal Hocko SUSE Labs