Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp1591252lqa; Mon, 29 Apr 2024 12:55:15 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUxi+/zw60sTe9adi88RbyZyF2pCapHaNfKP65nbOD3xjZSlb++o90x3DdQTWUe5EJ9GUZCdHb89dxFoeGEPskkev+lv0uSDrt6+jQaPA== X-Google-Smtp-Source: AGHT+IGrp6875Uz0LFDagR47XR2eq/Iqdnsb+nmwM03Xj8KV4seN5lY5UU5ufWJURHYoxMHl+D5y X-Received: by 2002:a17:903:240a:b0:1e9:6609:37d4 with SMTP id e10-20020a170903240a00b001e9660937d4mr14716340plo.9.1714420515669; Mon, 29 Apr 2024 12:55:15 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714420515; cv=pass; d=google.com; s=arc-20160816; b=lE0mB7eW/c+3/kWXnV+HvWwL73/4ylbRtCRX/ji2BYkC+5lljKQvowpdOkEnq+Ull8 lGoecQY8Z1vOCvi4iLlALdqTbWubfZWykxbzu5uOGzTt4kjR9VBaWtGgormBpgU7vAZA +Z8B5GixuUPpsnLuG0gG8VKbRvTt7s9bAUfY9rSkmFnQvMIYxdtCfI0QiEZdbkg0Q3hg scvN2v/pJC2WDsnMDIC2BBPHm06Jw0oiUB+sIiTRUYInahMXXgZATOnW7Lp1Rt0VSclx w3OQLmdtz8lzX2l3vpo4tN9qE+Au0iUViTXhfNlWg0RfGiMm1CtNRF1srGnF0x+gerXI m7+g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:dkim-signature:date; bh=pbbKQkKWKhZZZX+xv6puyDF4u7BZGj2cFK9rsyf5wYI=; fh=rNK0kzYwGKippN7649PSRkkZ0BvtlJP2RaYgGpBHLCY=; b=LkVZ3NKH9/Q5ZUAJ+kN7OW/1bSGhV9+CqDds50dL4fWHPeJ9A9SCnT0r2J5RYdpFCB QlGdi6mWtMBEtadjCydMsb6lUsgwBhZikyTYJ8KAvMmWYq37gbJU286g/esRguN9WlvZ 6m+K0ELECISYP524jIT3MTw7TPxaN1D7MN47LUUV5ta2XNUutF7OqwnrGe18JGAF2doG zEu8t9r5RLFrrJbWxnKPlzpWv7QFizIZBcqkgg/2/qC3xC4tBQOEkb/HKCVm7h2MJ8qH JZxaEmdNVqneiK2N/iMX7n4E8w7a3DLtLHPgOcbqQOAQdtvI/zo1MpMO7L/na6s508FT 8Pwg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=HZoS1UWZ; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-162975-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-162975-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id e6-20020a170902ef4600b001eb790bd911si3985978plx.55.2024.04.29.12.55.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Apr 2024 12:55:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-162975-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=HZoS1UWZ; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-162975-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-162975-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 41EDFB20B67 for ; Mon, 29 Apr 2024 19:54:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 24166135A45; Mon, 29 Apr 2024 19:54:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="HZoS1UWZ" Received: from out-182.mta1.migadu.com (out-182.mta1.migadu.com [95.215.58.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A2EED128807 for ; Mon, 29 Apr 2024 19:54:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.182 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714420456; cv=none; b=fJtdtMO6TsYwzOoxwjbQVEwB/GzQSo2MzEIZ8xiJXOYWoWEqa+mnQS9FowHJnAs/K0MZvI/mKY/b5xm9gOG17QN7zdOoTRRG+OsQHzt309Rs6qORpxJ8jxzNXkTSwy/DN3hhuR4CaLVBAY6mUBt6TTcRANaHO8AAHUOuAibaq7w= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714420456; c=relaxed/simple; bh=PfeQWhR1Lzg+FveSwt5O3o0HEKsYd2v6agDjwMPG3jw=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ZL8gPleYDMWzzqyoRs/3f1PZ+UuiurDMca/XSKqjmtUCmSVXUo1scrHNw+g2P1Fi/Q/QUaBVQwaVutKQn/dbBGIexthMWzqijdOskzwbvRunrFLAv7noTUF/SVP/rP+Kc2XcAai02563mcfg0YvFPrTM1K4NaN5qCQgzN9w6hOE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=HZoS1UWZ; arc=none smtp.client-ip=95.215.58.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Date: Mon, 29 Apr 2024 12:54:08 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1714420452; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=pbbKQkKWKhZZZX+xv6puyDF4u7BZGj2cFK9rsyf5wYI=; b=HZoS1UWZ16WAYJWw5jqN5f0tj3Bp2UTjUvDrhBgpm8WA2NyNvcsC6CUceQjoD6eqtOUib2 px50FFk9LO/OdwZSiVpK1voQPCkNgH65yrEGG0QcILm+NL7oOHzE6O3j2FyzYRIrnsFIlU q+xlKg16gWlBJHTrYOtC+jfO1qzoGA8= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Shakeel Butt To: Johannes Weiner Cc: Yosry Ahmed , Andrew Morton , Michal Hocko , Roman Gushchin , Muchun Song , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 5/7] memcg: pr_warn_once for unexpected events and stats Message-ID: <5eh7nwj6tnl76bkwnksgbb63mjmvf3rzlaevepcxecl3xhmkc7@hbcmkhseaoky> References: <20240427003733.3898961-1-shakeel.butt@linux.dev> <20240427003733.3898961-6-shakeel.butt@linux.dev> <20240427142234.GA1155473@cmpxchg.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20240427142234.GA1155473@cmpxchg.org> X-Migadu-Flow: FLOW_OUT On Sat, Apr 27, 2024 at 10:22:34AM -0400, Johannes Weiner wrote: > On Fri, Apr 26, 2024 at 06:18:13PM -0700, Shakeel Butt wrote: > > On Fri, Apr 26, 2024 at 05:58:16PM -0700, Yosry Ahmed wrote: > > > On Fri, Apr 26, 2024 at 5:38 PM Shakeel Butt wrote: [...] > > > > > > Can we make these more compact by using WARN_ON_ONCE() instead: > > > > > > if (WARN_ON_ONCE(i < 0)) > > > return 0; > > > > > > I guess the advantage of using pr_warn_once() is that we get to print > > > the exact stat index, but the stack trace from WARN_ON_ONCE() should > > > make it obvious in most cases AFAICT. > > if (WARN_ONCE(i < 0, "stat item %d not in memcg_node_stat_items\n", i)) > return 0; > > should work? > > > > No strong opinions either way. > > > > One reason I used pr_warn_once() over WARN_ON_ONCE() is the syzbot > > trigger. No need to trip the bot over this error condition. > > The warn splat is definitely quite verbose. But I think that would > only be annoying initially, in case a site was missed. Down the line, > it seems helpful to have this stand out to somebody who is trying to > add a new cgroup stat and forgets to update the right enums. Sounds good to me. I will change it to WARN_ONCE().