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 C89DECD4941 for ; Thu, 21 Sep 2023 03:14:37 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C970E6B0095; Wed, 20 Sep 2023 23:14:36 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C46466B009B; Wed, 20 Sep 2023 23:14:36 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B0E376B009C; Wed, 20 Sep 2023 23:14:36 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id A18816B0095 for ; Wed, 20 Sep 2023 23:14:36 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 7055240EAB for ; Thu, 21 Sep 2023 03:14:36 +0000 (UTC) X-FDA: 81259136952.15.FE06BD9 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf15.hostedemail.com (Postfix) with ESMTP id CE8C5A003B for ; Thu, 21 Sep 2023 03:14:34 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=uWvzVrAN; spf=none (imf15.hostedemail.com: domain of mcgrof@infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=mcgrof@infradead.org; dmarc=fail reason="No valid SPF, DKIM not aligned (relaxed)" header.from=kernel.org (policy=none) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1695266074; h=from:from:sender: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=SCXgHyJZGhjaqUfFGquv/AGCdJtUKcQzBvEtg+zXiaw=; b=PefWbi5V4z8/C7hONKtCgXsuahLXzOsiBPeyqoHSVQwIQqPf+fLoL4MV/NuUYO+gu6a/Az P8KpcK5x0435l3jFJwxy+c/o7ZeoFcrnI86+EaXAk753yEUjByXl6FWMSMpnk8XUt+QeZE zUwqyQIW42DLyeln3clJ4Pkff+q6xOc= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1695266074; a=rsa-sha256; cv=none; b=FOFsQgeirsNrGG7frGmVtro1toE5rJFyTAlZ+ArSEXv108RodjUPqivMKLktmePj7hAfhw aoSoS8VnGKvPV4UhyHy1cwYg634DaOL/GpLrqQAQOGtQcxHzmCr2PRHDy/6hiJ4QQ9xqd3 I7hBovC6NOKr00J9s2S6dM095hSCw1A= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=uWvzVrAN; spf=none (imf15.hostedemail.com: domain of mcgrof@infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=mcgrof@infradead.org; dmarc=fail reason="No valid SPF, DKIM not aligned (relaxed)" header.from=kernel.org (policy=none) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=SCXgHyJZGhjaqUfFGquv/AGCdJtUKcQzBvEtg+zXiaw=; b=uWvzVrANKhUwfNVS1gqC2WUylG aUdYNAu9l4Ieft7wo+vsG3QeoCSM/PA5lNcacnFP+5rlwpHoRIKzPpPsaXXjtCpbt5bvQfbQgBvI4 ZXb6za90QA3fv3lO2QybVH0CLLDJIz7MOm+EFnwB+xQwXs1QK2GrADxFjKRk0pLnNg+kOd1LKFpoM 7+UbHm1b0GDoUzBTWsW6cxgclo9iD6NPUiJcUMUDO3lDs2FSWn6gL6zzErtMfTz2WRXTDDP+QcjWK m1eqIJq5we4lN7rf7spkLseHr4Mj1eLXcv/cq92QK39lHpNCy1eTpt8KEDd+apBa/xCPm04OkZRMU pv8rxvnA==; Received: from mcgrof by bombadil.infradead.org with local (Exim 4.96 #2 (Red Hat Linux)) id 1qjA94-004sVS-2D; Thu, 21 Sep 2023 03:14:26 +0000 Date: Wed, 20 Sep 2023 20:14:26 -0700 From: Luis Chamberlain To: John Hubbard Cc: Zi Yan , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Ryan Roberts , Andrew Morton , "Matthew Wilcox (Oracle)" , David Hildenbrand , "Yin, Fengwei" , Yu Zhao , Vlastimil Babka , Johannes Weiner , Baolin Wang , Kemeng Shi , Mel Gorman , Rohan Puri , Adam Manzanares Subject: Re: [RFC PATCH 0/4] Enable >0 order folio memory compaction Message-ID: References: <20230912162815.440749-1-zi.yan@sent.com> <5ac6a387-0ca7-45ca-bebc-c3bdd48452cb@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5ac6a387-0ca7-45ca-bebc-c3bdd48452cb@nvidia.com> X-Rspamd-Queue-Id: CE8C5A003B X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: u71o6nnrhpceagh8cw5ma77xbbz6aatz X-HE-Tag: 1695266074-834130 X-HE-Meta: U2FsdGVkX19m3UDb2ZQ79aWV1S9P+K3G9+wb5sfkqSHbQGzCbzT1SN//xRnS5z2G7LKmDpTnnKna9LMLxezDaAtP64HqoVhhQD5yz7fSCozs/TSbr2B2+ee0+Mx4DN/mpjqrEszNn0pEHb21AQZ21OpywpFAbCCim5QM/2eXSZp1XV9gb9lkt4iOq/vRuKN2fElE63ZXtGwI74guKrePF0TXVzyG6yIRRpH/4Oi654EtVlW+ymH+U35o++AW2mlwsrIDhxU9se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F40wnBjHs8iEN62xV/vhBW14nAwgbRaql+ThP 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 Wed, Sep 20, 2023 at 07:05:25PM -0700, John Hubbard wrote: > On 9/20/23 18:16, Luis Chamberlain wrote: > > On Wed, Sep 20, 2023 at 05:55:51PM -0700, Luis Chamberlain wrote: > > > Are there other known recipes test help test this stuff? > > > > You know, it got me wondering... since how memory fragmented a system > > might be by just running fstests, because, well, we already have > > that automated in kdevops and it also has LBS support for all the > > different large block sizes on 4k sector size. So if we just had a > > way to "measure" or "quantify" memory fragmentation with a score, > > we could just tally up how we did after 4 hours of testing for each > > block size with a set of memory on the guest / target node / cloud > > system. > > > > Luis > > I thought about it, and here is one possible way to quantify > fragmentation with just a single number. Take this with some > skepticism because it is a first draft sort of thing: > > a) Let BLOCKS be the number of 4KB pages (or more generally, then number > of smallest sized objects allowed) in the area. > > b) Let FRAGS be the number of free *or* allocated chunks (no need to > consider the size of each, as that is automatically taken into > consideration). > > Then: > fragmentation percentage = (FRAGS / BLOCKS) * 100% > > This has some nice properties. For one thing, it's easy to calculate. > For another, it can discern between these cases: > > Assume a 12-page area: > > Case 1) 6 pages allocated allocated unevenly: > > 1 page allocated | 1 page free | 1 page allocated | 5 pages free | 4 pages allocated > > fragmentation = (5 FRAGS / 12 BLOCKS) * 100% = 41.7% > > Case 2) 6 pages allocated evenly: every other page is allocated: > > fragmentation = (12 FRAGS / 12 BLOCKS) * 100% = 100% Thanks! Will try this! BTW stress-ng might also be a nice way to do other pathalogical things here. Luis