Received: by 2002:ab2:2994:0:b0:1ef:ca3e:3cd5 with SMTP id n20csp335638lqb; Thu, 14 Mar 2024 12:34:50 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVu3kTrl6LHzTO2qry5Sg8RADr/4mN9ZMnbw0II27aYzyde6BdyL24VnGqcykG4X8fWcby+UbtKTUc2UCIDRUW96dO56CR5aIp7l+HsSA== X-Google-Smtp-Source: AGHT+IEn2/gaMOLP/FJv8nyF/ixIam5NovEMQI0SXWe7R2mOpA7shLPGJ/eyPLmGgsvq5zR3m6eq X-Received: by 2002:a05:6402:43c6:b0:568:a523:a677 with SMTP id p6-20020a05640243c600b00568a523a677mr1199546edc.27.1710444889902; Thu, 14 Mar 2024 12:34:49 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710444889; cv=pass; d=google.com; s=arc-20160816; b=0ikFoMkxysqn4Tl3yK6ifKrPtv5VR3WE1WryfwtBAgHeoStmiWCVk19m3oABYPso4K SQQW82xesoyBiDqdZ54sXO+HGNisEjX9fGJ933DWmkIG/ML9VrC0CkCoBUlFXiXqCrCv vKNyKZqybi/uV4bDoAAVTSsvWNFSIi1cW6NCpf/Veq1y+R2e0/UjdLqKlFPZ0mb2De+5 ne7uEU0f9U8rlIeBLCYyghIBHYILjQZoXR4fvAxJCso4RRmDZehwUWTERLIx/0HMyMIz bnxtJ9SH+2Ft/mvcE8nMqH+aTEPqWEPbvMJ/nVnqXw+mL74BxbhfcuNE+cPbW+AFsyQZ UTWQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=Gu8ndvCosLfR13D/hsYz/cv9ogsH/tqd6hyUv+jcRaM=; fh=sEcUbuN4jc8DRL8YUaC79Xc0MbWnHLRs6WrEg4wyWsY=; b=WhtKQKl9JMhmiVHQWm5Fv7u+fImWv7QK3MUXEbZkf4Xbp71tkL2LzBVq0j7bVVgzaR 7NnJyfu51uI4LrovUSvKCRo648kznODehy61+kSuxEl4S9etfbrpUS726h5o98UjUuCw IHFC9mSV+8jFonyNc2P8eQZNCKI3cIlyJ0If3b0Zp+GhRcUUtezU0upEwMi3vFraMebI puN0/s4EOsqvJDGk1TRABvECz1KlMmRx1HrVsqaTnOas+LrK/g0aNmwMMTmBCbJu7Vyw pvwn4LnAtTSrQBsVA2NzAW7IvBkKAASmV4rct3nRPnYLNOvl96DihmAu7p+TpeM/MXYO e9bw==; 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=NvGrvbtf; 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-103732-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-103732-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=soleen.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id d6-20020a056402400600b005689d108491si1069712eda.596.2024.03.14.12.34.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Mar 2024 12:34:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-103732-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@soleen-com.20230601.gappssmtp.com header.s=20230601 header.b=NvGrvbtf; 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-103732-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-103732-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 9EA951F2259A for ; Thu, 14 Mar 2024 19:34:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 547BC75807; Thu, 14 Mar 2024 19:34:44 +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="NvGrvbtf" Received: from mail-qt1-f169.google.com (mail-qt1-f169.google.com [209.85.160.169]) (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 E84F72E410 for ; Thu, 14 Mar 2024 19:34:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.169 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710444883; cv=none; b=NMwLuPZuvyBlBU1q82KgcrSYVRrVN8MO5NAeIrnn8Jht+Nd3DzqVtMiIrH/CLJaJJgzpvrWeFgbpDktr3M2vY3Inbs+BP6gU8i3ZzV4B+M54+bH92WbQXuULTnul2vBr9kUyZvpOtmeS9Bie49cJINCGgM/g6b6ssPxRw30ZsRE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710444883; c=relaxed/simple; bh=Gu8ndvCosLfR13D/hsYz/cv9ogsH/tqd6hyUv+jcRaM=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=Ca+CUwEiI5FCnFQDdGkzcpbLz+Q3Cwt2c6tl0r/ZpjN1VMhrMKnFYb1uaQEOFmRkejgqri0Gt8O0sKgei3x9U6qxiS7JMOUEbTobo+c6pVhb0MiLNSvrdkdJWzbSrAUIytFYVKBAm192vO1x4dzEs+ieMnm+msQrvCeP7O1vyy8= 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=NvGrvbtf; arc=none smtp.client-ip=209.85.160.169 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-qt1-f169.google.com with SMTP id d75a77b69052e-42a029c8e62so8959001cf.1 for ; Thu, 14 Mar 2024 12:34:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=soleen-com.20230601.gappssmtp.com; s=20230601; t=1710444881; x=1711049681; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=Gu8ndvCosLfR13D/hsYz/cv9ogsH/tqd6hyUv+jcRaM=; b=NvGrvbtf1Kwp25RAZmnTcVC0aF6bpZqbwYjXn4JQm68VaNxi6MbUjWuhmZV0FlPePg Mk5/GYaK/3C+o3yF5i0d3d4oXHQJZgyZNCEuw6nLyvCrLjit9bYXUxh2njQz6qQgy4l4 ldFW7VqZYnXOm01PbXWM9gOX0cz9qU68IwjHfPyju12/n4iAWFU6Fm7PRolbQG2aMqtn FhLiOCujBcYpeXtLOeqgLyaLRrjznn1wKnT3UX89ajBzJmcEksbSOPX/ptubvxYlY2CL XnQM1IwRvtZ5MBc3TY+7H/5ztD7IN2waqNweb3WhxhQKIZ4pIHATEah4710eTRxDPgI2 F7tg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710444881; x=1711049681; h=content-transfer-encoding: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=Gu8ndvCosLfR13D/hsYz/cv9ogsH/tqd6hyUv+jcRaM=; b=P2uabfLyFCpbsF2J/cUnyvY+/WDIRthYHsok4sLbQqYXv9r2FX6thq0xoBt8uIukQr fASzMTjIxdmebvoi2/jNnDpGBtOPtXN1dNmZadOkPLBeHzGD6LlfGAR3rGmCAme3mF1w 2WVH+P+OPswRdhIsfG/cexW+OJcVhu4KjO1kQDrpLOkuvO6AvmoOcBNtPWuJuCZMs4D6 ouRdIqYMYHVqZGsan/TLT8jjNeELUGwC+5s49xtS9vYprVnLIED6fQFI1EWV7ZQwLh1K PV4mrz3ah00XIJu082CCCZG3+AgPLAU6AIiSrZNDYTTisTC3o3gWu+wbFSEDxJZBf8OI qdkQ== X-Forwarded-Encrypted: i=1; AJvYcCUlE4KxHVwcJQ0Jqkz4bi8Nxu5CmZb4nuPKCMPJKgQMEHqMqzldhitipi/jQJ5lG1+Umnh62KPJbKP+yjAHixe8qUwLAGgy6166isab X-Gm-Message-State: AOJu0YyfARcZ7i1ihbBTQDy7Lw0obMqRclwxCptNxjXqMq2oj3HMZYwg sNpkJ01d7ZtitTwFLCR7UFbdUwozsC8ostSUF8MjE9swIycp0VTWYe7SAG1T2uDOYid8krlLgnO ceEBhI5J9mubyhjS1y+0E6yk5xYtU1+Iy6MlKmg== X-Received: by 2002:ac8:5f8e:0:b0:42f:30bd:fc8b with SMTP id j14-20020ac85f8e000000b0042f30bdfc8bmr1956069qta.63.1710444880851; Thu, 14 Mar 2024 12:34:40 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240311164638.2015063-1-pasha.tatashin@soleen.com> <2cb8f02d-f21e-45d2-afe2-d1c6225240f3@zytor.com> In-Reply-To: From: Pasha Tatashin Date: Thu, 14 Mar 2024 15:34:03 -0400 Message-ID: Subject: Re: [RFC 00/14] Dynamic Kernel Stacks To: Kent Overstreet 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 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, Mar 14, 2024 at 3:29=E2=80=AFPM 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 fle= et [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... 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. > 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.