Received: by 2002:a05:7412:1703:b0:e2:908c:2ebd with SMTP id dm3csp3391545rdb; Tue, 29 Aug 2023 14:08:49 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFtXrsEUQWg2LuSN7tOFumix2LYXoTDEIVCsDF8F4BMAElAEdZ5hBEQh+GZ+P+dlv26LagV X-Received: by 2002:a17:90a:2e0b:b0:267:7743:9857 with SMTP id q11-20020a17090a2e0b00b0026777439857mr387015pjd.17.1693343329424; Tue, 29 Aug 2023 14:08:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1693343329; cv=none; d=google.com; s=arc-20160816; b=N+6AcGg4mADCC8uYR/CseGXjtwlxT+nhusXGY64vlGQmLq4oCmgc12ZSAEo6/Nd3av ZCahIczzbzuC5w/zM1chLaDb9rKyMk2YkitK6H8ZN97XGhF3pabQpU24cXBKh/KG9pTk ewbY5gcomgfpMoTzaRgEu0/YWXWPJ8llqMippA+QxVDPQbs8W1Dt9UY/1hGfltNp/Ooz LO3L2zPqYjQWWpPQ5gi3346FEPgu3Uyr+eg0KL66MjQKbKLPFCMXshKYt0Pb5l46J529 cGvxV2nzVUk3zRk0I5n3qrykIwRtL3dZAs+yGp8NsYVnXZyb7FlTlSeB2vQo51Ma4/UQ mnIw== 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=BOigw10DFMaZ6FlTz/kuzcWWW1zJctEYt2mbUACfshw=; fh=lAudCpUAf3Copn39qL/Z4ZPUuaAyNy+iytOQ46slOBY=; b=n0POzTXyews79IXrkrh4Qj4wSwwJG44P/vBg+JiMJq7QZ2qpa00X/aD+9A8xkru98i OHGy0ydQxYECba1y09P5QVXVMmaoxfduLkBkLs2Z46vqHnsAsh8t6bkTam9yZTOujCTw W7ElkHsv2yMFGoSHhGTYPu5lvn8iRtujC/Jl29YYP/k+BuvYXmHihVHFM38PoyRkg0+y Zwvu6l9Gg+chgbE2HxQ9bn23EEiQPzwj+OxrUfdS3FWxx+pwt6V8gQOPcbZtgV8u3KFc Xyyd4aL9ItONiv2biz8ZLb2OT/rQQxjg8e82ohMRP+xd2FVXYXWZ8EaOaNtk/TQkdtZh y47Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=cf6cfut5; 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 w93-20020a17090a6be600b00257482b1795si47474pjj.166.2023.08.29.14.08.17; Tue, 29 Aug 2023 14:08:49 -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=cf6cfut5; 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 S236979AbjH2PRq (ORCPT + 99 others); Tue, 29 Aug 2023 11:17:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52368 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237213AbjH2PR3 (ORCPT ); Tue, 29 Aug 2023 11:17:29 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F2E9F194; Tue, 29 Aug 2023 08:17:25 -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 AD4CE21863; Tue, 29 Aug 2023 15:17:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1693322244; 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=BOigw10DFMaZ6FlTz/kuzcWWW1zJctEYt2mbUACfshw=; b=cf6cfut5qMHHLRMDbwkQ2gYlsH8BstjRGecp7d4wrj6kl1juJGA88uZVLY/nIkvn4joG6o yc1WtUrbFGH37RngP2icfs7mhlOiLLHfvX3nXod/VcciRd/wn+9pFBlSTbq9Qw6JFxynhg vLQnqh8YI4Amh1yo0orGgcpcoRZ6h+E= 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 9863913301; Tue, 29 Aug 2023 15:17:24 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 0DXgJAQM7mSfHAAAMHmgww (envelope-from ); Tue, 29 Aug 2023 15:17:24 +0000 Date: Tue, 29 Aug 2023 17:17:24 +0200 From: Michal Hocko To: Waiman Long Cc: Yosry Ahmed , Shakeel Butt , Andrew Morton , Johannes Weiner , Roman Gushchin , Muchun Song , Ivan Babrou , Tejun Heo , 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: <599b167c-deaf-4b92-aa8b-5767b8608483@redhat.com> <5906501e-4dff-4c66-7ab3-e9193d312270@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5906501e-4dff-4c66-7ab3-e9193d312270@redhat.com> 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 11:05:28, Waiman Long wrote: > On 8/29/23 03:27, Michal Hocko wrote: > > On Mon 28-08-23 13:27:23, Waiman Long wrote: > > > On 8/28/23 13:07, Yosry Ahmed wrote: > > > > > Here I agree with you. Let's go with the approach which is easy to > > > > > undo for now. Though I prefer the new explicit interface for flushing, > > > > > that step would be very hard to undo. Let's reevaluate if the proposed > > > > > approach shows negative impact on production traffic and I think > > > > > Cloudflare folks can give us the results soon. > > > > Do you prefer we also switch to using a mutex (with preemption > > > > disabled) to avoid the scenario Michal described where flushers give > > > > up the lock and sleep resulting in an unbounded wait time in the worst > > > > case? > > > Locking with mutex with preemption disabled is an oxymoron. > > I believe Yosry wanted to disable preemption _after_ the lock is taken > > to reduce the time spent while it is held. The idea to use the mutex is > > to reduce spinning and more importantly to get rid of lock dropping > > part. It is not really clear (but unlikely) we can drop it while > > preserving the spinlock as the thing scales with O(#cgroups x #cpus) > > in the worst case. > > As I have said later in my email, I am not against disabling preemption > selectively on some parts of the lock critical section where preemption is > undesirable. However, I am against disabling preemption for the whole > duration of the code where the mutex lock is held as it defeats the purpose > of using mutex in the first place. I certainly agree this is an antipattern. -- Michal Hocko SUSE Labs