Received: by 2002:a05:6500:2018:b0:1fb:9675:f89d with SMTP id t24csp135855lqh; Thu, 30 May 2024 17:15:06 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVJCE9q80WNGA8x6bVP3BdY34k6HuIyptsXbcECCJ7nNSacWZRruxiGQTCnFSeOogfpY4maHd2MWJIogm7Snbn0nItsd6bXezSJW43ufg== X-Google-Smtp-Source: AGHT+IE+Zgl1OMTvZFjnObMMc31PUWIP6WeQXu1BZzdriG/rS0HnwLtL40+n2l+2s+47b4u3ftQV X-Received: by 2002:a05:6214:4806:b0:6ae:47b1:58a with SMTP id 6a1803df08f44-6aecd503019mr5623746d6.0.1717114505759; Thu, 30 May 2024 17:15:05 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717114505; cv=pass; d=google.com; s=arc-20160816; b=qh1hwO8c4lLpX7VTQvE4COET2jJhPwCd6LeN/aTpuJA5d7s6NDXpsiEQEhwZpmU3Z8 mt/YALE4lfJIU0b4zXfCLSi5D4a4slUQpzPuLEJue02Hbo6uisC+6tSWIU8OuA5Y9WES 084bz2UEoL/Ll9z2xVqvSiM0pyqVd7ft1LuJjkC0fRzDZ3mGE45Ccagq0GmYU0DxuDFC 6Me7nLdaEynRvKrSkwAhhxKvnmY4RcsWSO5vOSqPQLu+mevneaX305KTGcWSz9O+p0ae +dDMYQT1JKXOWjnLxQAUbn6uhk+Hxhd/2rTqpUaa+GIvQ3ZIE3QUf5F+GiG+DPC4dhE8 VMjw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :dkim-signature; bh=YlITfRGBGkiGQh2yf2/+rH6KbsrWEjN3IQxGzASO3WU=; fh=3Ro9HvD/lxNXCTFPw3dug8De5eqptoZFCnAecaAHUVc=; b=x8itYmj0HmJXcmJ3OjqoK/+eiIRoNv+AzAZ6c7s6tMhLVr5jo+NLqifdIkRAENcEA2 KZ5pWakyzEoPg8KgPK5U68PpLc2noKw8fMnBQ9ub5bj6TK+5AGiZq0h9Tso0jVnyCJ3W Oaym9A4rNWFoWRHb7mp+f4G4Ik2apVg6AVDpgWI6XTTILUVDbm5xi/Cw1adEn7uO7yUB c13uzNUlulGdXXXWHwiTFjVeeehAEEjW2frwiBfi46x20qzQ9x5ehHIdPdMDEf/fyq2A wsD7aFKPqlRbAmzTDTeRrmKgzLZXlgki/AfRPgUlnwZm90dkeOQXzw+CKPRxDyUhLLSf +sJA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@soleen-com.20230601.gappssmtp.com header.s=20230601 header.b=Mvh9XmQa; arc=pass (i=1 spf=pass spfdomain=soleen.com dkim=pass dkdomain=soleen-com.20230601.gappssmtp.com dmarc=pass fromdomain=soleen.com); spf=pass (google.com: domain of linux-kernel+bounces-196066-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-196066-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=soleen.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id 6a1803df08f44-6ae4a741f35si8784906d6.153.2024.05.30.17.15.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 May 2024 17:15:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-196066-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@soleen-com.20230601.gappssmtp.com header.s=20230601 header.b=Mvh9XmQa; arc=pass (i=1 spf=pass spfdomain=soleen.com dkim=pass dkdomain=soleen-com.20230601.gappssmtp.com dmarc=pass fromdomain=soleen.com); spf=pass (google.com: domain of linux-kernel+bounces-196066-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-196066-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=soleen.com 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 408C41C243D2 for ; Fri, 31 May 2024 00:15:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 427EC1103; Fri, 31 May 2024 00:15:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=soleen-com.20230601.gappssmtp.com header.i=@soleen-com.20230601.gappssmtp.com header.b="Mvh9XmQa" Received: from mail-ot1-f48.google.com (mail-ot1-f48.google.com [209.85.210.48]) (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 A377B360 for ; Fri, 31 May 2024 00:14:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.48 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717114499; cv=none; b=LAh7RCqM+8YEhlJ4+CQi6Cq5VeqYbalskrl3SUfox8dm1FmzeCvB2m1KPHMXQQ3mxuJYhH+z3e1OQHhOxS740VoHu4EvayXT4KzcEuiybzhJPhYL8Wr7QL7/QDyDNQtjKLNeFTa3leh2kBtyQs7q9YHWAlmOZNtVY+wq3j/lZwo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717114499; c=relaxed/simple; bh=YlITfRGBGkiGQh2yf2/+rH6KbsrWEjN3IQxGzASO3WU=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=o8qOO65jdsPTngZCMgBTlo/itQzElQeD1sEXaO0fs9dWAtpdzF8yvKPAyDOQwZDNijs1b8VB3WFKCDOIeVjJnPAJoAqEDjDKwyOt72UGaG//9mjQRom7+hfWcDfYzwp85CDn5Z8sRV7Ab2ju+A2zwIix4tYiUIyppnefOVvfJ3k= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=soleen.com; spf=pass smtp.mailfrom=soleen.com; dkim=pass (2048-bit key) header.d=soleen-com.20230601.gappssmtp.com header.i=@soleen-com.20230601.gappssmtp.com header.b=Mvh9XmQa; arc=none smtp.client-ip=209.85.210.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=soleen.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=soleen.com Received: by mail-ot1-f48.google.com with SMTP id 46e09a7af769-6f8d0a00a35so409703a34.2 for ; Thu, 30 May 2024 17:14:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=soleen-com.20230601.gappssmtp.com; s=20230601; t=1717114497; x=1717719297; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=YlITfRGBGkiGQh2yf2/+rH6KbsrWEjN3IQxGzASO3WU=; b=Mvh9XmQaBMDZYrSgJZQ/XsN7HJrFQtFCGWhQ5JX+uzN9iom+YUyQGSGfEQIBrRQRpU KLiKViVidBTPCjeZKGriRRYVlZrLwFrFDOztuygIYXsE210zGXPMzmlifzqYcxL00lPg esWDqlvCE8pvgqsIiaoYO0bIhMIy92P2CarfQnEntuSTlTpvhXHyjH3errNlMh6FfBCm LJks1/V1xErhIVJYIZOaWSZcF59u83tp7qO6ot8HmksVscFeIPteykG14jiQPxywyi4N s9OzuK7+27lQbDllPysg/Md7ITxp6UFyUknYxYKqfh0UcCCjxZ5nEDZJvKQxp14rW0qi aNKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717114497; x=1717719297; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=YlITfRGBGkiGQh2yf2/+rH6KbsrWEjN3IQxGzASO3WU=; b=AkEraAWXgotj3UL7eTXaFj2bG7OEmrb8qruc3cjXCEA7SeZAw6liV3D21qN5pz2sxr 2LNQ2KA/V1hqBn//fH6huxR3T8+qQSCCHyZEbcMwJaRjzmWbhDEj00ipiiprnBeJdMq1 k1WioHGrnwUiiedNUVJ/B+q07VvUk+h7ch0ZGAV1DCWlMsLSfdcorxN5+Xfo7pKfc3Y7 2HmaKPcNZKV93FvLBphVoAG/sz+Sh/5DhJI2VdDhLDfPgMV9JQ9/uBKyHpm3I8162gt9 Ramdle5kEOXJsTMyYn7COwUwIvYYHK0L9Yhl59uzrojWyD7+OAuC8398n/8ygVyjkAu+ UDmA== X-Forwarded-Encrypted: i=1; AJvYcCWByV2TRIpaqgB1MzSK/uM+WkHiMg5KwqhsBA+lo0E+/TpSyMpD0qmZ4xTlYjb6EPKmi4HPz6eYJwk8ZH7/IAmzcPMHEZiLkj+dkFLs X-Gm-Message-State: AOJu0Yy/GRNHImQRVLOimbIcEG/pjnDPhFlvG17ZJ8iP3WHScJRiY3vQ BEkOOxEVkVyl1MmksXVIfAmzV3egvuawVo+nhQvs9AVQIOzZAexFebqelDRyk1+VkCBkq77Lqvf IMMXit/h30TUeTroQvQZCDqCwznUAVjqIlDlXwQ== X-Received: by 2002:a9d:4e94:0:b0:6f1:17ef:ef11 with SMTP id 46e09a7af769-6f911f48505mr375247a34.22.1717114496660; Thu, 30 May 2024 17:14:56 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240530170259.852088-1-pasha.tatashin@soleen.com> In-Reply-To: From: Pasha Tatashin Date: Thu, 30 May 2024 20:14:17 -0400 Message-ID: Subject: Re: [PATCH v3] vmstat: Kernel stack usage histogram To: Shakeel Butt Cc: akpm@linux-foundation.org, jpoimboe@kernel.org, kent.overstreet@linux.dev, peterz@infradead.org, nphamcs@gmail.com, cerasuolodomenico@gmail.com, surenb@google.com, lizhijian@fujitsu.com, willy@infradead.org, vbabka@suse.cz, ziy@nvidia.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org Content-Type: text/plain; charset="UTF-8" Hi Shakeel, > Couple of questions: > > 1. In future with your on-demand kstack allocation feature, will these > metrics still be useful? (I think so but I want to know your take) It depends on how on-demand allocation is implemented. On hardware that supports faults on kernel stacks, we will have other metrics that show the total number of pages allocated for stacks. On hardware where faults are not supported, we will most likely have some optimization where only some threads are extended, and for those, these metrics will still be very useful. > 2. With on-demand kstack allocation, the stack_not_used() needs to be > changed to not cause the allocation, right? This is correct, in my WIP dynamic kernel tasks RFCv2 patch series, I have an optimized version of stack_not_used() that uses the number of allocated pages in the partially filled vmap to determine the last stack address. > 3. Does the histogram get updated on exit only? What about long running > kernel threads whose will never exit? Yes, for performance reasons, the histogram is updated only on exit. It would be too expensive to calculate for all running tasks. However, it could be extended to be queried on demand via a debugfs interface for all running threads. On machines where jobs come and go over time, this histogram will show the actual stack usage distribution. Thank you, Pasha > thanks, > Shakeel