From patchwork Tue Apr 18 19:12:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Weiner X-Patchwork-Id: 13216091 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 A8126C77B75 for ; Tue, 18 Apr 2023 19:13:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 390DB900002; Tue, 18 Apr 2023 15:13:26 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3409F8E0005; Tue, 18 Apr 2023 15:13:26 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 19413900002; Tue, 18 Apr 2023 15:13:26 -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 ECF408E0005 for ; Tue, 18 Apr 2023 15:13:25 -0400 (EDT) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id AE165C044C for ; Tue, 18 Apr 2023 19:13:25 +0000 (UTC) X-FDA: 80695460370.11.F7BE550 Received: from mail-qv1-f48.google.com (mail-qv1-f48.google.com [209.85.219.48]) by imf12.hostedemail.com (Postfix) with ESMTP id E0D3540009 for ; Tue, 18 Apr 2023 19:13:23 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=cmpxchg-org.20221208.gappssmtp.com header.s=20221208 header.b=phgXjhYw; spf=pass (imf12.hostedemail.com: domain of hannes@cmpxchg.org designates 209.85.219.48 as permitted sender) smtp.mailfrom=hannes@cmpxchg.org; dmarc=pass (policy=none) header.from=cmpxchg.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1681845203; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=R5SnIlaO0rXlDNrbIipd1QFsl3Kwll1/DWWk9w0ZS8w=; b=lY2ACfj4UWzeg42nJ4dd145OgfiNvsJ8LpMyVKeNkO2MqQdfYgPe9Uv2US78PGrPK6TVu7 3MVlLEa0/KRnqOpQk2wTLyGx5KxH5/jZ3VSNij/MgJhaK5f0gUbswN4g6Cn8soas4qx7D5 1qt0mqR1dp+TJWk29UFaJzL76Q+PB3c= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=cmpxchg-org.20221208.gappssmtp.com header.s=20221208 header.b=phgXjhYw; spf=pass (imf12.hostedemail.com: domain of hannes@cmpxchg.org designates 209.85.219.48 as permitted sender) smtp.mailfrom=hannes@cmpxchg.org; dmarc=pass (policy=none) header.from=cmpxchg.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1681845203; a=rsa-sha256; cv=none; b=bmsh3SCQg4mpYxViSYmQFFPt7zP3bpzGumMoz5KY+IUnW6M8rOTYDmiElSKh7EYtdMjwhy A95igYn5oOzTbxkevZvJ0pvlI35FW97aar3KbBUsKxXFbybVENoO9ADjaqHrCEemF+O/36 l6GF+vzYFv+aYkUxscl0btC9gfvwGgc= Received: by mail-qv1-f48.google.com with SMTP id oj8so1342652qvb.11 for ; Tue, 18 Apr 2023 12:13:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20221208.gappssmtp.com; s=20221208; t=1681845202; x=1684437202; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=R5SnIlaO0rXlDNrbIipd1QFsl3Kwll1/DWWk9w0ZS8w=; b=phgXjhYwXg3OCGPRKhBvTgFcaFQYHSKs8TQycpKy6Vj7NYOeHax3ZHG4ro7qbt6UuA JF51v3B18zEUVvZDZnNNDBXHiS2b6Tq1HXFiJxKw9p+6Mx89Rgd2RJU/zsjn7vLY241i MKeUzmB5AHKtmXkf4hDMRr20OIpBEF+bV8qpHw5olo3beiyALYxqKqMbkp/HbNpGk7NJ ukwixb6eSH0cNmhdMS8bZQt3NGWA7C/bL+/YY6wI83+dKvJxLNBr78X4ennNHHmOj0Yt 5r4Yf3GUa7UROctvzCXAsXuKLK1G6qtC30yjMZWjnRlXK/bEWWb7onJzOj7tlzRdljt6 Babg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681845202; x=1684437202; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=R5SnIlaO0rXlDNrbIipd1QFsl3Kwll1/DWWk9w0ZS8w=; b=gGmZn1MFTOiCuAkjSJwW/lYFcXNrqAGwuv8JzBob3OMnNeKENA2fO9BvZBCHf6jSSM k7v3BD9T7RDWCH9gbljdO3lx0LNvAlDuLKvLle0Vmy0ZE+JR8g4XMpQ2ox17M1mgHk9e K/SrV3qDs4cqGVGDcEGV3je3m6bXUChdDluiOUDI+P+xdFn6GEJF1kEvw84y+62VOYQz CA8FHIKQblOm6tivq6EGTpRas/rnLYXEf0Hd6F4nleiuBpWo3H0ndAludRKiTorDpZlk qcNi2SzQ53VFcT+4dUTknwMnIILtDaX2rv3UcFuEBgwkQbLH9cxZZEY0pGwWI4jGm8j3 t5Gw== X-Gm-Message-State: AAQBX9ePcdphvams8Rmn/rNHNKOGt7GfvIJdFg54njoZ5g28XXiClnKy OsQU6NMePkVppVaYeedN4FG7ao8t43zXidFfTBg= X-Google-Smtp-Source: AKy350b9afMxBv6edVSpodj5/I8/s1MMj3kTb89vTQ4djsDWn/SVzn9x9uBL9GyIXdZ9FhPbmcE+vA== X-Received: by 2002:a05:6214:20ed:b0:5c5:c835:c8f1 with SMTP id 13-20020a05621420ed00b005c5c835c8f1mr25959976qvk.22.1681845202760; Tue, 18 Apr 2023 12:13:22 -0700 (PDT) Received: from localhost ([2620:10d:c091:400::5:e646]) by smtp.gmail.com with ESMTPSA id o5-20020a0cc385000000b005ef4ee791casm3855524qvi.120.2023.04.18.12.13.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Apr 2023 12:13:22 -0700 (PDT) From: Johannes Weiner To: linux-mm@kvack.org Cc: Kaiyang Zhao , Mel Gorman , Vlastimil Babka , David Rientjes , linux-kernel@vger.kernel.org, kernel-team@fb.com Subject: [RFC PATCH 03/26] mm: make pageblock_order 2M per default Date: Tue, 18 Apr 2023 15:12:50 -0400 Message-Id: <20230418191313.268131-4-hannes@cmpxchg.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230418191313.268131-1-hannes@cmpxchg.org> References: <20230418191313.268131-1-hannes@cmpxchg.org> MIME-Version: 1.0 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: E0D3540009 X-Rspam-User: X-Stat-Signature: 8r41fa487jfwoqw4gfofszqb91fk3hxp X-HE-Tag: 1681845203-469295 X-HE-Meta: U2FsdGVkX19af50ycMdTzht76vCQGcf1xUFLByMfL/BcYUPhQodI0FkV/0IUdHe2ihcGAL8FLt7gxFXUt+uB73eZc+Zbvtv6WUu8pbaOycJIvVdoceSfRpGWwLrYzI4Tr0+ceucgIDLyTamdJx8KmNmAjXWSU7fbYcetq16d4enSXKeq9/VtuTThsbmoF3qhuVMEwfX+qFJmB50JO/n/y5u/Cc7lQo7yo9O1Abi3PiFuLBi7GClNLHiu887bHWeSG+6J7CtD56LG4bhdOYPb+RpevQf8/vjwFMP4i12antcSgCL89t79O/p1FDidwA8ZDmduzaoHAZ55zdCd/ySvsir8NXK7ifjSBJvXGGCGE3gO8mQM4UC0MNeiAZGg5fx++SESpb+nCrXMOUAycUt8Uz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E274AX6VC0Ns2knbfPvnt4wzbUw9mo9U8rP+W1ft/UbMat9VpZVOUorBw== 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: pageblock_order can be of various sizes, depending on configuration, but the default is MAX_ORDER-1. Given 4k pages, that comes out to 4M. This is a large chunk for the allocator/reclaim/compaction to try to keep grouped per migratetype. It's also unnecessary as the majority of higher order allocations - THP and slab - are smaller than that. Before subsequent patches increase the effort that goes into maintaining migratetype isolation, it's important to first set the defrag block size to what's likely to have common consumers. Signed-off-by: Johannes Weiner --- include/linux/pageblock-flags.h | 4 ++-- mm/page_alloc.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/linux/pageblock-flags.h b/include/linux/pageblock-flags.h index 5f1ae07d724b..05b6811f8cee 100644 --- a/include/linux/pageblock-flags.h +++ b/include/linux/pageblock-flags.h @@ -47,8 +47,8 @@ extern unsigned int pageblock_order; #else /* CONFIG_HUGETLB_PAGE */ -/* If huge pages are not used, group by MAX_ORDER_NR_PAGES */ -#define pageblock_order (MAX_ORDER-1) +/* Manage fragmentation at the 2M level */ +#define pageblock_order ilog2(2U << (20 - PAGE_SHIFT)) #endif /* CONFIG_HUGETLB_PAGE */ diff --git a/mm/page_alloc.c b/mm/page_alloc.c index ac03571e0532..5e04a69f6a26 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -7634,7 +7634,7 @@ static inline void setup_usemap(struct zone *zone) {} /* Initialise the number of pages represented by NR_PAGEBLOCK_BITS */ void __init set_pageblock_order(void) { - unsigned int order = MAX_ORDER - 1; + unsigned int order = ilog2(2U << (20 - PAGE_SHIFT)); /* Check that pageblock_nr_pages has not already been setup */ if (pageblock_order)