From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qk1-f178.google.com (mail-qk1-f178.google.com [209.85.222.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5D1CF1A0730 for ; Wed, 19 Mar 2025 18:06:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.178 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742407612; cv=none; b=SBUtH0iPhZk9HTg1ZHiqTCiXHeKddRhNW6ume3GzcedglNEz0pworhHQNRKkTvNWtYZappWkefsyxoT4eQRPeHe6r1Gw1bj8OZyJeeIPPAMHW2Pb4nui+sK4+JUO1Vp5SltuQXeqrF1ir0n0+8CSwxPRv8dT9r3UlhvFIkS17/g= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742407612; c=relaxed/simple; bh=PSoiUXOsPCOJzGfaX6x9D+rZ847fmNdDd34M+1viIaM=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=fJuRDODoRWuLUkjcALpB2q1jlqt5PzyLE0ckqpuw6amaFu1w+Rz3RnnsTYO7M4/rC4Ksn3a2+fHo0l2mDG6JEcU1VUFVJG3oeocGgp2+y2adWeo7tI5rEAF5nWOwsxm3t0mcxnhJeOhcA5Y2oqtj/9V6VSUU0tecb99hpxBvOGY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=cmpxchg.org; spf=pass smtp.mailfrom=cmpxchg.org; dkim=pass (2048-bit key) header.d=cmpxchg-org.20230601.gappssmtp.com header.i=@cmpxchg-org.20230601.gappssmtp.com header.b=sHu2dfGW; arc=none smtp.client-ip=209.85.222.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=cmpxchg.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=cmpxchg.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=cmpxchg-org.20230601.gappssmtp.com header.i=@cmpxchg-org.20230601.gappssmtp.com header.b="sHu2dfGW" Received: by mail-qk1-f178.google.com with SMTP id af79cd13be357-7be8f281714so778004385a.1 for ; Wed, 19 Mar 2025 11:06:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20230601.gappssmtp.com; s=20230601; t=1742407608; x=1743012408; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=1NubMu+PJrXrK7FSH6frb72hGV0SUS0LkaEj4SuXE4k=; b=sHu2dfGWlOP6m6/nT4M5C/KNBJIryr7QX48KN/dOZWuOhuBSbKix+A462/LukjrhUN wZMpL4xfZo2r3T+qXD+OCX+SpsN//7Z0glmZxfOokqF4S8cAHdUDrb+8OUVpq5Q7eJrp 5l8PsA3c/ore+3KUzO5oL4xBDWuSkOfnMl6/BvPQ2LSSuFnTLvZ7idkEC4kCoyybjFAq UjuHK6oU2Y12mPjgbOEgb0dOT0ajn5iePzaYhuXIrya+aTgMWRpiD3IMpHKa/mgp4Ob1 sT98UO1iz19iU6cBPoTiGnwKD9WbQanar6YtQYqcQppcx99d/BtNFBfoW8+0ozxXmsIc QJ4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742407608; x=1743012408; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=1NubMu+PJrXrK7FSH6frb72hGV0SUS0LkaEj4SuXE4k=; b=lUjIq6otnEf6G/qx4T2YLatJEaRqwHeS3FfGzLRKRs0Rwp2A0dhrr8qznjM1PFUFps Xm4hwCUBhgUF9Rjlu8Qgb/aNygvndNjfiBZKQ9AnQ1ADscHWc4Vuem2hi9ztKZxFxggr BTvD6fpfrBnUu7z9zC+L+78T8029oYkZdvl9fy3L8ilw5grB8VhE8P4Po0C7OVXGx1ia 7g05ogaVAgRYZoT18icSmJOzVV2vOfVyyJfgORrvJ77MW8oylkdtpfq7OSZt3GwyqyjT 5Ykq21ZiOg/nO/YBGizEzIVfKwz9aGHIaEAR1EydV0Ws6MDb+aPmiiefYUZgx4ONteyk z7PQ== X-Forwarded-Encrypted: i=1; AJvYcCVt81xXP9UtIhc2favFSEgHevg46ZJ7+ffHlutuiLR1aiFgun0hpr+KKYlKUtc43G9vTg2oRfXU@vger.kernel.org X-Gm-Message-State: AOJu0YzZnqzZnH4peSlreP8aBuOKudQuJLiMsd0+gPCsnxxgJfW8bQYR F+mSDb50YRMAMTfRAWgbI+gCintJqcYtioeyuACtczBrWADDqYXX+Lm9bdM09NI= X-Gm-Gg: ASbGncuHaBVWt5d3gZgO/9nAS2zIrFWtXLdoXGOCzy2RT0sstHloG0KssdDOiZ0Owp3 pT1o7J7KfNzO949s4xpHlmsJEMuK972yGj4jxjssIntdMlbRCaIydsNway9vmKeZR2JvJyevaui tWVtlXMTapBvcT6i8IhaV9SNq2TyZAwDLUJd4v37z2QP/90ddhmNZ9tJrppzPn5p4fsydOe7uJg LugdXGR0VFUCPISThJovBV8L0eOluuK8YaCUonMF0pG8nvPr3eHjQofg5YfBc1bzfQxZoIW3pNO X5G9gXhr3O94xLGlXBkxY0xySXXHVQzGanrZjinxsr0= X-Google-Smtp-Source: AGHT+IHiSAMT4qpEHY5hxrStqDgNaN2Q83H85X1DL7R0E0NeRn5pbKUwIbbATANiD9rmFjdJm9FC3A== X-Received: by 2002:a05:620a:408a:b0:7c5:5909:18ca with SMTP id af79cd13be357-7c5a83ca625mr516096485a.26.1742407608056; Wed, 19 Mar 2025 11:06:48 -0700 (PDT) Received: from localhost ([2603:7000:c01:2716:da5e:d3ff:fee7:26e7]) by smtp.gmail.com with UTF8SMTPSA id af79cd13be357-7c573c9c669sm884839585a.64.2025.03.19.11.06.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Mar 2025 11:06:47 -0700 (PDT) Date: Wed, 19 Mar 2025 14:06:43 -0400 From: Johannes Weiner To: Yosry Ahmed Cc: Greg Thelen , Tejun Heo , Michal =?iso-8859-1?Q?Koutn=FD?= , Andrew Morton , Eric Dumazet , cgroups@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Eric Dumazet Subject: Re: [PATCH] cgroup/rstat: avoid disabling irqs for O(num_cpu) Message-ID: <20250319180643.GC1876369@cmpxchg.org> References: <20250319071330.898763-1-gthelen@google.com> Precedence: bulk X-Mailing-List: cgroups@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Wed, Mar 19, 2025 at 05:16:02PM +0000, Yosry Ahmed wrote: > @@ -365,9 +352,8 @@ __bpf_kfunc void cgroup_rstat_flush(struct cgroup *cgrp) > void cgroup_rstat_flush_hold(struct cgroup *cgrp) > __acquires(&cgroup_rstat_lock) > { > - might_sleep(); > + cgroup_rstat_flush(cgrp); > __cgroup_rstat_lock(cgrp, -1); > - cgroup_rstat_flush_locked(cgrp); > } Might as well remove cgroup_rstat_flush_hold/release entirely? There are no external users, and the concept seems moot when the lock is dropped per default. cgroup_base_stat_cputime_show() can open-code the lock/unlock to stabilize the counts while reading. (btw, why do we not have any locking around the root stats in cgroup_base_stat_cputime_show()? There isn't anything preventing a reader from seeing all zeroes if another reader runs the memset() on cgrp->bstat, is there? Or double times...)