Received: by 2002:ab2:2994:0:b0:1ef:ca3e:3cd5 with SMTP id n20csp342714lqb; Thu, 14 Mar 2024 12:49:42 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVbSVdN3Lvb1+GAatDzI5iX2Y8q6hqPKnYwD4BEfgf4OQcPBdRNpBKhiGvd/UbdHWSitXaxYvokcNcp251fjFrOgLACAThL1BDWNuH5Hw== X-Google-Smtp-Source: AGHT+IFrkmqwMqaQSfIHwAYUI23ycHfBziqDlTg03JnDjmGoCPGHwsVpOW5pqZktqxXeWwaR7hH+ X-Received: by 2002:a17:90a:68cd:b0:29c:6ff8:fa32 with SMTP id q13-20020a17090a68cd00b0029c6ff8fa32mr968780pjj.3.1710445781773; Thu, 14 Mar 2024 12:49:41 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710445781; cv=pass; d=google.com; s=arc-20160816; b=R8qhm3TeoKJv4gbd1V0Kq9xy34iqy0yrDqZW77HWcQdrZR8239U6bT04u+KX1BWRGh lHun7P6NPV+TfJCmUwEnLWaj32OHBbxYQaqSb/xbsjcc/XARvR/CHslqWlaJzjYuC/Hw rV6pgmaMyf5R128mV407/eydKf9Py9IrnVy5yH8vqRqUeTW7SG/QF0ZBfqHvcoLJKnYi fN/q8orVSGMC4U/g0uHcNXhEEyFDsv0yHY97V0GSp/eFlMXNhzO8U3qG00wzsw3G246x 5iabvenzW6bFaO1OmLhyNvIOI+NOuOOYGyepnUf+4q3Yw+eeL1zL+EJBh8ztI1NgB5v/ 3qqA== 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=oQhKBgFBwcHxMMVU5RZZVIyABjVMSjCmIgF/D8RmMd0=; fh=e6T5KBJiba8qwy8Ok5EgdZLbYFYhW4BSIqolTe2c41g=; b=hKwhcmeBUFLHHkh2QCfpZ45WavyTHWlQ42aUwpzAxGyZ/LZ6MT8RaPjKarPPMbusoc mKENvl0TK5ujrfct/ySKwawXV7oAXTvgdoK39QxIn1rjFyFq7fGuAmq713Zm7q3ctd3A nk/tK5XNAywz2GZ+0Tz3ffAtsDnUvoRGeCyeVm10lY0LD/PVLeRknNRZ3gUCvQWrjDAs phXn2H/U+Spv26V8u5NmI+/NXTLpWphNNP43hSzpyzseTzep+ijLUxzrvj2p51a+tbN0 qbx6qWZEozcZXhzOE/G/o/yJI4yBbvG2NECCeK+paNKU3eDlz4oM/OTTYsK3hJV5Mzms TQeQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=vyVBxkEC; 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-103740-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-103740-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id fw13-20020a17090b128d00b0029c66c75ef7si1218898pjb.165.2024.03.14.12.49.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Mar 2024 12:49:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-103740-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=vyVBxkEC; 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-103740-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-103740-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 7532A283CE7 for ; Thu, 14 Mar 2024 19:49:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5FC977581E; Thu, 14 Mar 2024 19:49:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="vyVBxkEC" Received: from out-178.mta1.migadu.com (out-178.mta1.migadu.com [95.215.58.178]) (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 DDC162A1C7 for ; Thu, 14 Mar 2024 19:49:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.178 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710445774; cv=none; b=C5Utkt+yQ/riH/h9T0kjwt0Vps/EJ1brwbdese6BzQtNkVv4J4uzLTu0dZ2NSc5R030x1ZIhTrcboGUKpas+Je+Q4QES9AFUHkFlU9F2y+kNhQbXYEcd0T+ClJuAG/lj71qrnI7bpWYrD7Mb68z/Fu6xwDAsQYLwzChHjVfXiw4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710445774; c=relaxed/simple; bh=ey6aZZyO2yRwiBcrrQcQ9Tn3xCXf1wH5j+sk0+rlaiM=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=CyKu0WbWipEtLXvvxwHAIKZhOIasmqwlX9MVngAIP+QC+D6QGwrViBxu9BxoYYOj+RFZtXxKB3S9rtFunuTue1OHmHvrWjhhUIONA28Se824B7crbAMiUKwWptWE7yv8KFBE/hsnoBEO+D2DH11yv7kIwWV7TfuTSopR2aZtxxs= 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=vyVBxkEC; arc=none smtp.client-ip=95.215.58.178 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: Thu, 14 Mar 2024 15:49:22 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1710445769; 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=oQhKBgFBwcHxMMVU5RZZVIyABjVMSjCmIgF/D8RmMd0=; b=vyVBxkECVqaeyjcPV4xlon4xwRuqkYRismZotCyCVT8L9bU6/2JAk/tIYs0I0psufu68LS juN/mOOUJVXdHan06zn33FPTtVqRAfcOxriZVnKnmyKM/q1RTUi2qyNDsw+OAhAPmYsvp1 72SJigfNEAjBd0ZzHdWYSxTd7iQcRCs= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Kent Overstreet To: Pasha Tatashin Cc: "H. Peter Anvin" , linux-kernel@vger.kernel.org, linux-mm@kvack.org, akpm@linux-foundation.org, x86@kernel.org, bp@alien8.de, brauner@kernel.org, bristot@redhat.com, bsegall@google.com, dave.hansen@linux.intel.com, dianders@chromium.org, dietmar.eggemann@arm.com, eric.devolder@oracle.com, hca@linux.ibm.com, hch@infradead.org, jacob.jun.pan@linux.intel.com, jgg@ziepe.ca, jpoimboe@kernel.org, jroedel@suse.de, juri.lelli@redhat.com, kinseyho@google.com, kirill.shutemov@linux.intel.com, lstoakes@gmail.com, luto@kernel.org, mgorman@suse.de, mic@digikod.net, michael.christie@oracle.com, mingo@redhat.com, mjguzik@gmail.com, mst@redhat.com, npiggin@gmail.com, peterz@infradead.org, pmladek@suse.com, rick.p.edgecombe@intel.com, rostedt@goodmis.org, surenb@google.com, tglx@linutronix.de, urezki@gmail.com, vincent.guittot@linaro.org, vschneid@redhat.com Subject: Re: [RFC 00/14] Dynamic Kernel Stacks Message-ID: References: <20240311164638.2015063-1-pasha.tatashin@soleen.com> <2cb8f02d-f21e-45d2-afe2-d1c6225240f3@zytor.com> 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: X-Migadu-Flow: FLOW_OUT On Thu, Mar 14, 2024 at 03:34:03PM -0400, Pasha Tatashin wrote: > On Thu, Mar 14, 2024 at 3:29 PM Kent Overstreet > wrote: > > > > On Thu, Mar 14, 2024 at 03:23:08PM -0400, Pasha Tatashin wrote: > > > > > > > > > > My point is that what matters is total memory use, not just memory used in > > > > > the kernel. Amdahl's law. > > > > > > > > If userspace is running a few processes with many threads and the > > > > userspace stacks are small, kernel stacks could end up dominating. > > > > > > > > I'd like to see some numbers though. > > > > > > The unused kernel stack pages occupy petabytes of memory across the fleet [1]. > > > > Raw number doesn't mean much here (I know how many machines Google has, > > of course it's going to be petabytes ;), percentage of system memory > > would be better. > > > > What I'd _really_ like to see is raw output from memory allocation > > profiling, so we can see how much memory is going to kernel stacks vs. > > other kernel allocations. > > I've heard there is memory profiling working that can help with that... I heard you've tried it out, too :) > While I do not have the data you are asking for, the other kernel > allocations might be useful, but this particular project is targeted > to help with reducing overhead where the memory is not used, or used > in very extreme rare cases. Well, do you think you could gather it? We shouldn't be blindly applying performance optimizations; we need to know where to focus our efforts. e.g. on my laptop I've currently got 356 processes for < 6M of kernel stack out of 32G total ram, so clearly this isn't much use to me. If the ratio is similar on your servers - nah, don't want it. I expect the ratio is not similar and you are burning proportially more memory on kernel stacks, but we still need to gather the data and do the math :) > > > Number of kernel threads vs. number of user threads would also be good > > to know - I've been seeing ps output lately where we've got a lot more > > workqueue workers than we should, perhaps that's something that could be > > addressed. > > Yes, doing other optimizations make sense, reducing the total number > kernel threads if possible might help as well. I will look into this > as well to see how many user threads vs kernel threads we have. Great, that will help too.