From patchwork Wed Jul 24 20:33:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pasha Tatashin X-Patchwork-Id: 13741342 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3E384C3DA63 for ; Wed, 24 Jul 2024 20:33:29 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D2B436B0089; Wed, 24 Jul 2024 16:33:28 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CDADF6B008A; Wed, 24 Jul 2024 16:33:28 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BA2316B008C; Wed, 24 Jul 2024 16:33:28 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 9ABA66B0089 for ; Wed, 24 Jul 2024 16:33:28 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 576CC140BF0 for ; Wed, 24 Jul 2024 20:33:28 +0000 (UTC) X-FDA: 82375796496.27.8FA522A Received: from mail-qk1-f177.google.com (mail-qk1-f177.google.com [209.85.222.177]) by imf12.hostedemail.com (Postfix) with ESMTP id 6334340029 for ; Wed, 24 Jul 2024 20:33:26 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=soleen-com.20230601.gappssmtp.com header.s=20230601 header.b="AJh/nlea"; spf=pass (imf12.hostedemail.com: domain of pasha.tatashin@soleen.com designates 209.85.222.177 as permitted sender) smtp.mailfrom=pasha.tatashin@soleen.com; dmarc=pass (policy=none) header.from=soleen.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1721853182; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version:content-type: content-transfer-encoding:content-transfer-encoding:in-reply-to: references:dkim-signature; bh=CWxIEgcB4vNva4JPDGqrKuZlK47/5uUP1kyWXInS1OI=; b=2i+RZq/lsq0XEVNXvCcIMldpEnjkTUQ/+iZvBfpEaWWkHbiWoWTMrZSJsC8O9tJJ/bLeln TtBr+MKXsD9WNFwGQ+pYhnEWA8i8FVaX5l3u26Y5A43A03a/MPq3Dq25Zx+NpCS7xYrUEL XWXZFMt5+Oa+x5DPAvpYYKt+CaNiSfA= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=soleen-com.20230601.gappssmtp.com header.s=20230601 header.b="AJh/nlea"; spf=pass (imf12.hostedemail.com: domain of pasha.tatashin@soleen.com designates 209.85.222.177 as permitted sender) smtp.mailfrom=pasha.tatashin@soleen.com; dmarc=pass (policy=none) header.from=soleen.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1721853182; a=rsa-sha256; cv=none; b=Z/OaEWrUrMXnshAIrdwKFgFzZePZasPctJkWMDSkco7cJCf0/65MCrz4k0xRDFfV0CfxIh 5w06TdtmMRgbrL2o/7pIqukrioBhWIOq5ZQAX2MGywAl8XTD8m4QD0p16Q9wTkkAHwuwaw dmoUO0V1zE0mryLMKYftXNzbkdwXr9U= Received: by mail-qk1-f177.google.com with SMTP id af79cd13be357-79f323f084eso9235985a.3 for ; Wed, 24 Jul 2024 13:33:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=soleen-com.20230601.gappssmtp.com; s=20230601; t=1721853205; x=1722458005; darn=kvack.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=CWxIEgcB4vNva4JPDGqrKuZlK47/5uUP1kyWXInS1OI=; b=AJh/nleankoHGfBgNY2pFg6n4hOGMHXCFa+QIIDu2eRLRscVHda92M+y4057UdGAgp 4acSTHxwr0LYabcHoDt0LUPxf0E3/91zPrQ/mcBuy1RBXSjZiOMKCXD7UCkcz7QS2/x+ GusZ0eIXAeywTgoh+UP86GWkkp3fHqzK39oR16GtMPpnC5Y/V7WkEYgHrQ5ktHTzy3v0 E0DtloHdYQEFP+dK3pd8W6Gu3Ngy5589mp9gd7stk2RCl10dy9homE7v17u7FoAYm/uD oXhfplNW6giiR+wv04PqMxOGLt0+hKTj1pjhNHmUxRhJO+CGXFDXK/euML4Eg0IL+IMN o25w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721853205; x=1722458005; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=CWxIEgcB4vNva4JPDGqrKuZlK47/5uUP1kyWXInS1OI=; b=Ck0MBVaiywMeEDo8HO+aNUeMOo7HclgVdmtx7f1qg22Y1Qfo4hi8ymUID6J1vfR0EM g3SMxD0UuV56prmXxQHLPmi8GhuOg5xGxYXVZ3OqldZROZ1sP79HO3k4O4oQUaCNYscH 5R6jUYRM16PzuvEsOCl6YN9MhQkZ2edlLRhLY6FIVSRVQ4Lq5CAYgY4yc0S70uOdOvZi sTeFT7/yn4F976P9s91T11+ofXdB4mmlTd/yGnK3Tduj7fZuTEJS+WGU+/zz0gthPBhg 1VAO+QyR8TJ1QvtXHVvdbN7fU7YmUat1aPL9FdCEQulUYxTih84r1m1+TumN0LDF1eY8 liqQ== X-Forwarded-Encrypted: i=1; AJvYcCWIiWszy0sjvHDkoEBWTnWMFtSPiwr3D89kAhj6HHmwRe4u3BVtzge+ijKZMus8FIn2FWOVQRwx4WQnqXJFxUh0adc= X-Gm-Message-State: AOJu0YyGzPBo0qOQCb9zNRoOIGqs9W3p/XNxk/ofHLlRHDq+/29K6y6y tvSe6jZnBF9ddQ4+Wi9Z/lzT+rANGBoiZ/WZKMf+H7LfdhFHObixQcGYIv6Shcg= X-Google-Smtp-Source: AGHT+IHSALr6v6vzwBUEUWPezOtwnLgnF7lZxxXB5NdyNsgIcfEwO2tcQEiVgbcmYZENcYVkncoi5g== X-Received: by 2002:a05:620a:f11:b0:79c:f0e:f792 with SMTP id af79cd13be357-7a1d59d0c6fmr96424385a.51.1721853205399; Wed, 24 Jul 2024 13:33:25 -0700 (PDT) Received: from soleen.c.googlers.com.com (197.5.86.34.bc.googleusercontent.com. [34.86.5.197]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7a1d73b1786sm466485a.33.2024.07.24.13.33.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Jul 2024 13:33:24 -0700 (PDT) From: Pasha Tatashin To: akpm@linux-foundation.org, jpoimboe@kernel.org, pasha.tatashin@soleen.com, kent.overstreet@linux.dev, peterz@infradead.org, nphamcs@gmail.com, cerasuolodomenico@gmail.com, surenb@google.com, lizhijian@fujitsu.com, willy@infradead.org, shakeel.butt@linux.dev, vbabka@suse.cz, ziy@nvidia.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH v5 0/3] Kernel stack usage histogram Date: Wed, 24 Jul 2024 20:33:19 +0000 Message-ID: <20240724203322.2765486-1-pasha.tatashin@soleen.com> X-Mailer: git-send-email 2.45.2.1089.g2a221341d9-goog MIME-Version: 1.0 X-Rspamd-Server: rspam11 X-Rspamd-Queue-Id: 6334340029 X-Stat-Signature: gkznw3od4r4999b4i3kx19inpkpsheew X-Rspam-User: X-HE-Tag: 1721853206-926881 X-HE-Meta: U2FsdGVkX18zkANGEJDR15ChZRfnHXEAl1DmrmUdJGpNw0Mh0xzHyUgwMKqrJWjDnyD9bdwF4yWrUV3JKxf6FnnrB6DN5OOqEDs486r+S2pCM+3iRAtzIjKNSv92d0n5sdxUxgnbVLh/sSCwUoIYo3I0d3KTZ8mDKGp132BpWUrK/5mstm7hCK3M+1zmvnUag2iB8L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XZVRsdiIyimHt/1Q3kkBnZCD2Tw== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Provide histogram of stack sizes for the exited threads: Example outputs: Intel: $ grep kstack /proc/vmstat kstack_1k 3 kstack_2k 188 kstack_4k 11391 kstack_8k 243 kstack_16k 0 ARM with 64K page_size: $ grep kstack /proc/vmstat kstack_1k 1 kstack_2k 340 kstack_4k 25212 kstack_8k 1659 kstack_16k 0 kstack_32k 0 kstack_64k 0 Changelog: v5: Uninlined stack_not_used() and kstack_histogram() per mailing list discussion Use count_vm_event() instead of this_cpu_inc() Increase memcg_event limit from s8_max to u8_max. Pasha Tatashin (2): vmstat: Kernel stack usage histogram task_stack: uninline stack_not_used Shakeel Butt (1): memcg: increase the valid index range for memcg stats include/linux/sched/task_stack.h | 18 ++-------- include/linux/vm_event_item.h | 24 ++++++++++++++ kernel/exit.c | 57 ++++++++++++++++++++++++++++++++ kernel/sched/core.c | 4 +-- mm/memcontrol.c | 50 ++++++++++++++++------------ mm/vmstat.c | 24 ++++++++++++++ 6 files changed, 137 insertions(+), 40 deletions(-)