From mboxrd@z Thu Jan 1 00:00:00 1970 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 1CAA3C00140 for ; Fri, 5 Aug 2022 18:50:35 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 631BA8E0001; Fri, 5 Aug 2022 14:50:35 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5E1666B0072; Fri, 5 Aug 2022 14:50:35 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4A8B58E0001; Fri, 5 Aug 2022 14:50:35 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 3AC6B6B0071 for ; Fri, 5 Aug 2022 14:50:35 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 0BD9EC04A5 for ; Fri, 5 Aug 2022 18:50:35 +0000 (UTC) X-FDA: 79766430030.18.A061B7F Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf18.hostedemail.com (Postfix) with ESMTP id EC4CB1C0138 for ; Fri, 5 Aug 2022 18:50:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=N40CH4N73F1aD5pR/zImIWWFoHIInIlo6IUf8Y19MV0=; b=N6rJq8jMhgWcZ3MLB16mRqHuVE wHqstFKdhqAwhAarzMyJAF+t0mABjjawok3vFmh+pnewjj5k7atDabLw1ABjKta/ovvQtQvq5P6VP hxq70zWICpQEV2dSGHz1/tDKiRZNAHx6Dh4RQlVIe6/00LZ5NgagidUCpGiwUTRJCb/maR2eEUOlM XdWvV8yl9j6MIUGofJ8JRDAbvOZ18v1wMxoaqA5OGpxZkWorOhNBWC6fuuRSn/lUK/2dc9yAn3qhD kNnFw9KQIFPg3hwPAoWrGlgWVsAyFKQfr0srcQOiHHhxBLcbvKraQOBCBFIHn+bMQ9sJi4Dj37xVH xpA/fCrw==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1oK2Ou-00BUBv-EF; Fri, 05 Aug 2022 18:50:24 +0000 Date: Fri, 5 Aug 2022 19:50:24 +0100 From: Matthew Wilcox To: alexlzhu@fb.com Cc: linux-mm@kvack.org, kernel-team@fb.com, linux-kernel@vger.kernel.org, akpm@linux-foundation.org Subject: Re: [PATCH v3] mm: add thp_utilization metrics to /proc/thp_utilization Message-ID: References: <20220805184016.2926168-1-alexlzhu@fb.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220805184016.2926168-1-alexlzhu@fb.com> ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1659725434; h=from:from:sender: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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=N40CH4N73F1aD5pR/zImIWWFoHIInIlo6IUf8Y19MV0=; b=nSHYgDEJS8FevTdQ2MqJ5kuVqVMvj4IaG2ccmWDgBSdbmPL1dIekIjBXVQR6ogUeKVro++ IzEsyUASA4Mt3atX0r7caRNflNpJq7sMLRDNQsx9KxAIF10ZtI++JNF82enTOL3qxG3TOf wwhXOUlUBVILWVPDC+t80hpzvOndEIs= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=N6rJq8jM; spf=none (imf18.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1659725434; a=rsa-sha256; cv=none; b=lxeDQ+G8XyM2t60+raEzksPS28Udb+soXw6eJlWtP9UVNw7jqbJya91X5zeQx42MWsTWv1 6sWUdlJYLTu2LePD7NfrGTCeKX1wAc5H6Bb7dyl6HfhwfPkmR62oqxGLmm4Q+Qcl8akL0g G3DYpST2eCDdGpbqCoSNpnOTKaE+BOY= X-Rspam-User: Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=N6rJq8jM; spf=none (imf18.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: EC4CB1C0138 X-Stat-Signature: tjdrc975b318bpuxtt6sgho6fft9y1im X-HE-Tag: 1659725431-505806 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: On Fri, Aug 05, 2022 at 11:40:16AM -0700, alexlzhu@fb.com wrote: > THPs have historically been enabled on a per application basis due to > performance increase or decrease depending on how the particular > application uses physical memory. When THPs are heavily utilized, > application performance improves due to fewer TLB cache misses. > It has long been suspected that performance regressions when THP > is enabled happens due to heavily underutilized anonymous THPs. > > Previously there was no way to track how much of a THP is > actually being used. With this change, we seek to gain visibility > into the utilization of THPs in order to make more intelligent > decisions regarding paging. > > This change introduces a tool that scans through all of physical > memory for anonymous THPs and groups them into buckets based > on utilization. It also includes an interface under > /proc/thp_utilization. OK, so I understand why we want to do the scanning, but why do we want to report it to userspace at all? And if we do, why do we want to do it in this format? AFAIK, there's nothing userspace can do with the information "93% of your THPs are underutilised". If there was something userspace could do about it, wouldn't it need to know which ones? Isn't the real solution here entirely in-kernel? This scanning thread you've created should be the one splitting the THPs. And anyway, isn't this exactly the kind of thing that DAMON was invented for?