Received: by 2002:a05:6358:e9c4:b0:b2:91dc:71ab with SMTP id hc4csp2031046rwb; Fri, 5 Aug 2022 11:55:39 -0700 (PDT) X-Google-Smtp-Source: AA6agR5u8EfVCNstzhRlN0bPZ2I2CqK91HADHHTmWCWEKRKJ0biRz5KtRW0wAtLLCedXEnB9CtbL X-Received: by 2002:a17:902:7c88:b0:16d:3e1e:9ee1 with SMTP id y8-20020a1709027c8800b0016d3e1e9ee1mr7997926pll.102.1659725728054; Fri, 05 Aug 2022 11:55:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659725728; cv=none; d=google.com; s=arc-20160816; b=p6ArJtCCu5xBTcaLdK8XcYqJhpBswtmWuG0o06rUIuVA7AMFkmeHvEM09xuyExrpQG yH9Ronehs/i1XlBGplBMbtNPCfreOdi2oBl3CjFe44OT30NQkiz2C60qnhc5Ah4VCfPU uzHYE3HtW+3bFjW/Td+zdMEG1D+/F0m5HNzsLiI1IkHGT/CvdRjmJAOV+drrPXHlTbqe Tx6YXXc72ajJ+5DsKRt+b2dnknRTyfWVklT6XXobm/9bH5bVeDnRM6eOAzNQhdqb8rXq gbxc2tbm8ODpWUPdK1czebvT4kX2aVGjQWmYDXeqcKgPz6X+t8dpZPc/nw4WWq+qdtrg Cd4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=N40CH4N73F1aD5pR/zImIWWFoHIInIlo6IUf8Y19MV0=; b=Vryt38jwDzzNZ9EovV4rjdepqvfbLvo4cA0KtyW8Q/OjK+zUw4dM/rIYithO7RvqJM RnWFgR5LRgBg8Xid4kSesQgUt2fijHB7NpwxkXh/vM2CFZKh8rC7hb5nDJeRDeYiY9ou XGjxyeHgj4BimEugb/hY5JJvkJt/rX8Ni3bDApO2XMHLNAoXjLlu7anoK0U6Io4N5lpQ hxtL7AdrHPeHZROSFCb8TO1rDfq5fYXrmjH9eapOKNOWVSwOxM/1LUxoDrLPi6Il48kG 5qOU9SAed/c529Ftfwhl0Q/3zwQiRwzCpE3EZmsYaSAV3RuvEz6KgjkJ767ROALblu/u iR4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=N6rJq8jM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t25-20020a632259000000b0041bc27c4597si3619761pgm.163.2022.08.05.11.55.13; Fri, 05 Aug 2022 11:55:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=N6rJq8jM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241185AbiHESum (ORCPT + 99 others); Fri, 5 Aug 2022 14:50:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48504 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240985AbiHESui (ORCPT ); Fri, 5 Aug 2022 14:50:38 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5A6391CB28 for ; Fri, 5 Aug 2022 11:50:34 -0700 (PDT) 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> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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?