Received: by 2002:a05:7412:f584:b0:e2:908c:2ebd with SMTP id eh4csp1095691rdb; Mon, 4 Sep 2023 02:58:43 -0700 (PDT) X-Google-Smtp-Source: AGHT+IELOEczu8IJwuYI4wY+cRZlIb8NjMvkQARAtMuRdLL61YH/HsUc3oarqWvEfw5c8eWl6pnO X-Received: by 2002:a05:6512:401e:b0:500:b7dc:6c90 with SMTP id br30-20020a056512401e00b00500b7dc6c90mr7929769lfb.36.1693821523285; Mon, 04 Sep 2023 02:58:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1693821523; cv=none; d=google.com; s=arc-20160816; b=zowcEJ4Z9ZemUjNeCOT6Ej/qIKq0GF1AqvG3pWLMoauzVv5BXGG2baUEyb+Fh93awp KD7fP53vMyZ0CT113w0bgVUVPOcDcaQj7But0Dn2gRNBioh/Mt/mu2x54BQ4mt8+2zBj IeifkqXf9M3URwI38d6sg+/uoGk5RwPP5oP5W/R5Nxn9bdLPatr/nGKKkld/pXSkKtvY ws7jtrpcjIt9wb1f0dy7vwQvsMyOwF1C1HX/2GCPDkPiOZDKuFNjeFtjC++LDj3AoUXP +v1xWED5yRoAABjPVqHjpBMI2svzgckZi0f8nHhc2/zg+8RXXE39dJI6omWF/EP/S5ae ZMUQ== 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=DujY6dkqedsXFZeiaLXoDY/sYyiJ8dFrPRvd9QhXe4U=; fh=k2mI/0gD42TX6gMYEqk3WU2OAz7uUuXkywVg6pGQ6IA=; b=rfC4fNvBzRxX3l2mc20zZnHszmMUIn/LInf4/gqaS8ujFH0YIvT4KrK/TbIjCgbD7x vXJJ9hYuyz0h8N8JxeJ+pkff+QWjXibb5oEjlQbZpmDAfY8tj34wTP81/Gb/U/xh/D8G nn3D4AzVllII7irAI+AtTUCgIS2/D4YiHYASiOrVOthBosywlepXcKLbrY7YQlDqbr5m V1B7/vtwZ6+pZjnXQDWU1FMR63/CpGY0veh/UdVnlDSRfFkNqzoqwSeaOcJYqLvOOO+a VMh0GBVX6rJ12lBcSIs6Fn0DTlrzdjRxQmf0Q0v2s+axqLcV3jYUlmhiQa5JXYBS+VKz MOGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=TQbe7rXx; 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 z4-20020aa7cf84000000b005231977092fsi5921053edx.546.2023.09.04.02.58.38; Mon, 04 Sep 2023 02:58:43 -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=TQbe7rXx; 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 S238360AbjHaJFo (ORCPT + 18 others); Thu, 31 Aug 2023 05:05:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50130 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242756AbjHaJFo (ORCPT ); Thu, 31 Aug 2023 05:05:44 -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 13696CEA; Thu, 31 Aug 2023 02:05:39 -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 BDD2F21871; Thu, 31 Aug 2023 09:05:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1693472737; 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=DujY6dkqedsXFZeiaLXoDY/sYyiJ8dFrPRvd9QhXe4U=; b=TQbe7rXxOquuL1eiRja1QjBmuTWQRynSoCpR94kHmbf3Tw7pzzFmN0XBlcVvgYoueYiyQZ EAuxq5zsTcDlPZA2bzGEcVIGn3riohjif4a+PCyY7jvWVrgmvzDzsMsNttjkkgrEGpfBJH 4CsiLRzknMGJH4L/emjN7lQ08pLIzkU= 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 AD66813583; Thu, 31 Aug 2023 09:05:37 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id WcOdKeFX8GTpDAAAMHmgww (envelope-from ); Thu, 31 Aug 2023 09:05:37 +0000 Date: Thu, 31 Aug 2023 11:05:37 +0200 From: Michal Hocko To: Yosry Ahmed Cc: Tejun Heo , Andrew Morton , Johannes Weiner , Roman Gushchin , Shakeel Butt , Muchun Song , Ivan Babrou , linux-mm@kvack.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 3/3] mm: memcg: use non-unified stats flushing for userspace reads Message-ID: References: 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,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS 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 Tue 29-08-23 13:20:34, Yosry Ahmed wrote: [...] > I will add a mutex on the userspace read side then and spin a v3. > Hopefully this addresses Michal's concern as well. The lock dropping > logic will still exist for the inner lock, but when one userspace > reader drops the inner lock other readers won't be able to pick it up. Yes, that would minimize the risk of the worst case pathological behavior. > > I don't have a strong preference. As long as we stay away from introducing a > > new user interface construct and can address the noticed scalability issues, > > it should be fine. Note that there are other ways to address priority > > inversions and contentions too - e.g. we can always bounce flushing to a > > [kthread_]kworker and rate limit (or rather latency limit) how often > > different classes of users can trigger flushing. I don't think we have to go > > there yet but if the simpler meaures don't work out, there are still many > > ways to solve the problem within the kernel. > > I whole-heartedly agree with the preference to fix the problem within > the kernel with minimal/none user space involvement. Let's see. While I would love to see a solution that works for everybody without explicit interface we have hit problems with locks involved in stat files in the past. -- Michal Hocko SUSE Labs