Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp2833148rdb; Tue, 12 Sep 2023 13:36:55 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFv8RV9VTvrRE9utfDQpX3NKUmsNdIJyblpCC0BLqXkvUJYcUq2JLGNOhYC/4/gMuGZzh1v X-Received: by 2002:a17:902:b718:b0:1c2:1068:1f4f with SMTP id d24-20020a170902b71800b001c210681f4fmr808537pls.17.1694551015050; Tue, 12 Sep 2023 13:36:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694551015; cv=none; d=google.com; s=arc-20160816; b=Ya+hzSl93Eue8bG8ITeZ2qizgRYS0xWMsyDDE3qq/JBwtNYlXXyZ0M9UQhS0+uhYPx qvIUDYWDw+NITelnpdLWPOHt1jCsbZ1AT7DGDNEQY5RubRT35BoKRwZlw6D3y/WfpPzc 3KYm+DTL6HNluuJoce21k4VrCZAIW4nlhxw0HBmyx2tmeFA1JYnEavpqI/TtV7gKZ/6F UoojR2Mm/I4N+/Snm21/CnOOe3hRD182V5LkKqj/88l0pL/lj9iVPAaOgjK0f8S4HU/6 thN7xsYap1YB+eSfFdnoFDg4QCTIhp67Y/tvw4uDgY12elr9o/U66dfOpUv9fH04pdha 8WFg== 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=2ueVFGBowAWqGipfNQqUaUPs7n50soYsOXj5+ijJC44=; fh=Vo2BS86apGFsrH5kCrBjHWmZ6HYlj8WoBsrKJh6l97U=; b=JafVIXvqLAVgkZZs9N9yk+aGZNba1koqCq7JECjWiVE8UsG1PbPBLnnYoUjZ+SQCzA 2oD7gRhYXb9zI4XrLgmUoHM5wINSmlsuxMMMrcjT8rGI25FtRPYnry+NHAkrgXfSc6e/ E9OcCAzx5dS626Dmvf+mK9VzylLohXgzi3VnotwQVtS+vNs0HTLow10FtKWI54JWIJTG 9aa3zZkrMbZG13bXXv8nOcb+U+jnJwNfK9kd4YQqXj/Q0V6yM4FemgiOIO/tUQ/cCUvd dgTRC0bzZcqN7wZI4DNtMbLWjJrv1/8u4UQADm0WhUZZE+A/9gKirEbSJ8346OXNPiUj 2/ZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=QtRF3jYd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 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 pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id le6-20020a170902fb0600b001c0c86a541asi8444597plb.375.2023.09.12.13.36.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Sep 2023 13:36:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=QtRF3jYd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 0AB18805DC4A; Tue, 12 Sep 2023 04:03:56 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234254AbjILLDe (ORCPT + 99 others); Tue, 12 Sep 2023 07:03:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36792 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234179AbjILLDH (ORCPT ); Tue, 12 Sep 2023 07:03:07 -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 80EC710E5; Tue, 12 Sep 2023 04:03:02 -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 33DFD212AE; Tue, 12 Sep 2023 11:03:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1694516581; 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=2ueVFGBowAWqGipfNQqUaUPs7n50soYsOXj5+ijJC44=; b=QtRF3jYdgfuACICva/StORZig/bbcCipPnzhVC2F+GBibpItfwEZroTW4ipaKaDUcEYrci CIdZ6hWQ6nZI17dJMYDjydq7tl5/V9H1nOPckllPAQlAkuUNPxXzDulaN8ZBxrsOXiLp91 A+MUbTATQKvgsJiK3kpJGdkLyxR3GwQ= 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 24CF313A39; Tue, 12 Sep 2023 11:03:01 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id UHFZCGVFAGX9ZwAAMHmgww (envelope-from ); Tue, 12 Sep 2023 11:03:01 +0000 Date: Tue, 12 Sep 2023 13:03:00 +0200 From: Michal Hocko To: Tejun Heo Cc: Wei Xu , Yosry Ahmed , Andrew Morton , Johannes Weiner , Roman Gushchin , Shakeel Butt , Muchun Song , Ivan Babrou , Michal =?iso-8859-1?Q?Koutn=FD?= , Waiman Long , linux-mm@kvack.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, Greg Thelen Subject: Re: [PATCH v4 4/4] mm: memcg: use non-unified stats flushing for userspace reads Message-ID: References: <20230831165611.2610118-1-yosryahmed@google.com> <20230831165611.2610118-5-yosryahmed@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Tue, 12 Sep 2023 04:03:56 -0700 (PDT) X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email On Mon 11-09-23 10:21:24, Tejun Heo wrote: > Hello, > > On Mon, Sep 11, 2023 at 01:01:25PM -0700, Wei Xu wrote: > > Yes, it is the same test (10K contending readers). The kernel change > > is to remove stats_user_flush_mutex from mem_cgroup_user_flush_stats() > > so that the concurrent mem_cgroup_user_flush_stats() requests directly > > contend on cgroup_rstat_lock in cgroup_rstat_flush(). > > I don't think it'd be a good idea to twist rstat and other kernel internal > code to accommodate 10k parallel readers. I didn't mean to suggest optimizing for this specific scenario. I was mostly curious whether the pathological case of unbound high latency due to lock dropping is easy to trigger by huge number of readers. It seems it is not and the mutex might not be really needed as a prevention. > If we want to support that, let's > explicitly support that by implementing better batching in the read path. Well, we need to be able to handle those situations because stat files are generally readable and we do not want unrelated workloads to influence each other heavily through this path. [...] > When you have that many concurrent readers, most of them won't need to > actually flush. Agreed! -- Michal Hocko SUSE Labs