Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp1782384rdb; Wed, 20 Sep 2023 21:57:43 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF2vh9qGrLQixamgP9/q7honSrXe3XjKUF+IgxiT4l3b0ftHljf9X0Q56yM9kV0ZwqEqM2x X-Received: by 2002:a17:902:ab17:b0:1c2:eac:b99 with SMTP id ik23-20020a170902ab1700b001c20eac0b99mr4022331plb.40.1695272263123; Wed, 20 Sep 2023 21:57:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695272263; cv=none; d=google.com; s=arc-20160816; b=fKjOVEq+ACcBByBjp9vgH5LsGGshyS49n3nTizRtM5DeWQSfPl0STp3+/0jz3hVlYw ZDN9UwS+//8F/6MtatFrlT217IQeGq3b0wOdz1N80bu3O12M30n7yykekkDdMkRdzAgO rHAi8kg1KQowu0czzOzOJpZkk3778vv9DchXn0hqxnaTIlmLL5g5jOGxOynZ6mXBOz+W KB4TTvTOlqbpLyS+7mGYhPf03Uki/GxMubwIzK2GU2w/0bBhIzJ5XK2Mlrqo3mkchXeh j6vprKsACqi6JkbKF/YMIFn4P56KtDth4wuvfdOklrnop5HqfCk0sjSVhD5JIRe8hD9c 6blg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=SCXgHyJZGhjaqUfFGquv/AGCdJtUKcQzBvEtg+zXiaw=; fh=syKwld1XRJpEta1JC+dAUtBlDEDIB6wVKTOuHg2r2PY=; b=YXSiolZrYrzieBqOfjNO31vryLDtvkB9PCcqA0v89R+JhqUQWQft0ELelCrkDhvp4+ xz5BvTnIcwGxmXkct4YklxPPk8gyfEhb7H54nkuZYe5h9Xb6QnBTko6Zztf5aXeOTivv DY+x6TNFtgy3v6dskYeHHbLpK+sV9wU4KRdtia2GayVhdo9TTbDkcSnx/ds47JcN78vZ qkHXLDU7UIxia5xvxh/2Z1xbDk+BZPaB7RGLFHRu/YA3bYzNpV8TUc0exhHJo9lUiFrn i6H5AuMbgMeqKANZokKESp50RsvT+S54edf8ml8aDtKT4E/EOM02N5yCQ4VpKSaFNf/K eYCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=uWvzVrAN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id z17-20020a170903019100b001c465d564b8si655290plg.452.2023.09.20.21.57.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Sep 2023 21:57:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=uWvzVrAN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 67D408198C69; Wed, 20 Sep 2023 20:14:41 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229472AbjIUDOm (ORCPT + 99 others); Wed, 20 Sep 2023 23:14:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34216 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229445AbjIUDOk (ORCPT ); Wed, 20 Sep 2023 23:14:40 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E75FF4 for ; Wed, 20 Sep 2023 20:14:34 -0700 (PDT) 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> Sender: Luis Chamberlain X-Spam-Status: No, score=-1.0 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Wed, 20 Sep 2023 20:14:41 -0700 (PDT) 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