From patchwork Mon Sep 11 19:41:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Weiner X-Patchwork-Id: 13379608 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 D83F1EEB580 for ; Mon, 11 Sep 2023 19:50:41 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 183DE6B02DE; Mon, 11 Sep 2023 15:50:39 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 132896B02DF; Mon, 11 Sep 2023 15:50:39 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E9FB46B02E0; Mon, 11 Sep 2023 15:50:38 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id DBE866B02DE for ; Mon, 11 Sep 2023 15:50:38 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 76347C035E for ; Mon, 11 Sep 2023 19:50:38 +0000 (UTC) X-FDA: 81225358956.23.FB17560 Received: from mail-qk1-f176.google.com (mail-qk1-f176.google.com [209.85.222.176]) by imf02.hostedemail.com (Postfix) with ESMTP id A276380006 for ; Mon, 11 Sep 2023 19:50:36 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=cmpxchg-org.20230601.gappssmtp.com header.s=20230601 header.b=D8j56+fx; spf=pass (imf02.hostedemail.com: domain of hannes@cmpxchg.org designates 209.85.222.176 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=1694461836; 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=DXpNvTPTT9ib/tT2NTgBNzi3cETEqU1uBo715LHCaBY=; b=TSifFNpbWVaSbocgbJqHZewddPfcZesa9kyPOTIC6gMpuWzl+nCZJih++rOV03ZIxVM1VA Khd9HQwIIEHNiD5UPdzZtfQtDXoDpAxCL19qZIvaTALdjHpTufUDOyMR8t9FvCDzv34iE5 nty8xtfZXghscCX84l/i9qcjwyoSoL4= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1694461836; a=rsa-sha256; cv=none; b=NC/bk1IiTXSSwEOcuaC/fOGWvB/K0ilAjPti+ZVwySWTHaeEfo/dyTHmLJqCZVelsbJd/z 1YBK87XGVSJZ6KUd8SWc1e8WvCkGgDwRHCqml4OrGdE1pWARrgJSEMCZAzVwoxhnxHlaRm K6Mrz77CnsMJP5Jwqico2TeohNZvUi4= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=cmpxchg-org.20230601.gappssmtp.com header.s=20230601 header.b=D8j56+fx; spf=pass (imf02.hostedemail.com: domain of hannes@cmpxchg.org designates 209.85.222.176 as permitted sender) smtp.mailfrom=hannes@cmpxchg.org; dmarc=pass (policy=none) header.from=cmpxchg.org Received: by mail-qk1-f176.google.com with SMTP id af79cd13be357-76dcf1d8957so290912985a.1 for ; Mon, 11 Sep 2023 12:50:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20230601.gappssmtp.com; s=20230601; t=1694461836; x=1695066636; darn=kvack.org; 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=DXpNvTPTT9ib/tT2NTgBNzi3cETEqU1uBo715LHCaBY=; b=D8j56+fxZMdPv2m6ft7+OkZsS1Kb6FzQvuqq7WafCFewIinoaoy0lbf9Vrg9EMZPD0 XzqG03OP3g478g+YdaObzw12B050axR7hkdGThldqt9U7FCHOac82RPxmeXjZu9nzd3c Ila33PkhUQKcJ2vLFt7RPLZBQJ61eQyZ/aDEKNZ4D+84+FZwRSf64toXHSA53oG+0kf7 +rfoRLDxxsRpAraeMAc7dvS33E7uShMIR3kRj+cE9kKOrF0OcCVidCk2zPU9Oq2HFKdq /BDqJJWsNo68pPFWUfegeF5qedmV995udVt6ia3/jVh8CcIssbJah2grN/L4vDtB6CN8 yJyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694461836; x=1695066636; 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=DXpNvTPTT9ib/tT2NTgBNzi3cETEqU1uBo715LHCaBY=; b=MeKBlyhLR8xdgVxvMQ+zvk+w820EHWfkHJzFmLdVO3cCrKuVZn6nZjUbbpPcbJ5TIw Uff5HlNf7lqJ4Gbzv44xQnQgm+RrrbH1r+5rrFCgx+tlyTK9Xb9DJtNq7CTEfoJNwyVE mjLhBkm3rf6PD7M/r5luBdBo/34zmyo3Hp04jqEOlf+JnykrPQ6ah80YF3MU6YkUAyfM yWPYjye09Fb6q4UMLr5X+4kcaX1A9Wp04clky9uLn2X5zgw4YR1flhBjlj35hVHqGsnX LsMzvQyJVsJllm1feBS+9qBMPcTnxlQCHOxfxOcBa19wSeBTG/DhKpYY44/3Slis85Sq ZEbA== X-Gm-Message-State: AOJu0Yy5YmXltteyTlu1KfoCHtvM1RVcYJ7Xw4JgrPlWqIfhvTnyEpmo QqVastvMV7N0VywRNHy+2Oes0w== X-Google-Smtp-Source: AGHT+IFL0UuJsNEAxd5SAPx+lZ3HgMHaH/IGI5QCwmbwAzaYO1UWU+4wttoCCDMIY1y70kB2Wm1/ug== X-Received: by 2002:a05:620a:991:b0:76e:f279:4c36 with SMTP id x17-20020a05620a099100b0076ef2794c36mr9707748qkx.29.1694461835893; Mon, 11 Sep 2023 12:50:35 -0700 (PDT) Received: from localhost (2603-7000-0c01-2716-3012-16a2-6bc2-2937.res6.spectrum.com. [2603:7000:c01:2716:3012:16a2:6bc2:2937]) by smtp.gmail.com with ESMTPSA id 20-20020a05620a071400b00767d6ec578csm2724636qkc.20.2023.09.11.12.50.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Sep 2023 12:50:35 -0700 (PDT) From: Johannes Weiner To: Andrew Morton Cc: Vlastimil Babka , Mel Gorman , Miaohe Lin , Kefeng Wang , Zi Yan , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/6] mm: page_alloc: move free pages when converting block during isolation Date: Mon, 11 Sep 2023 15:41:44 -0400 Message-ID: <20230911195023.247694-4-hannes@cmpxchg.org> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20230911195023.247694-1-hannes@cmpxchg.org> References: <20230911195023.247694-1-hannes@cmpxchg.org> MIME-Version: 1.0 X-Stat-Signature: 4gfri8hcyjqsqhmsg3qhm5ktmhyj5x7t X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: A276380006 X-Rspam-User: X-HE-Tag: 1694461836-450816 X-HE-Meta: U2FsdGVkX1+FBSx0VNL5DlBS+r/fo0wRCSpZHi+Vk4BOBuryCdMtyhRNPA9RVVsWeDvD/3vxBXr3SZDpkjIwQy52gNYGYI+IscOskCMeLFGC2pS2XacMmvjRIcR2qNTsO0a02LTvurIezRGuDiJ3fTsG28zQScD8hSEmRxOppbTXmtmW1Iq2psKAe0I+//sstwWyMdkWsOeWYI2oOBc9iFMr9sd4cUqJFvm8cSnR0mPGicFdcT2e0yGO5VTsIWP1iyMEI737JWBQioTHFwtSyQWPC7f7u8xuFcZ5O3l7n2LoLo3wh2ujoLe0YnvsEjKBA8xudOvou9RU58vLuSf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Eq29/0+K6wQzYriMz1dwJeYfKmENUzfj7OgKLHihkbqtQw3BE6ANg1KzXdY= 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: When claiming a block during compaction isolation, move any remaining free pages to the correct freelists as well, instead of stranding them on the wrong list. Otherwise, this encourages incompatible page mixing down the line, and thus long-term fragmentation. Signed-off-by: Johannes Weiner Reviewed-by: Zi Yan Reviewed-by: Vlastimil Babka Acked-by: Mel Gorman --- mm/page_alloc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 3db405414174..f6f658c3d394 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -2548,9 +2548,12 @@ int __isolate_free_page(struct page *page, unsigned int order) * Only change normal pageblocks (i.e., they can merge * with others) */ - if (migratetype_is_mergeable(mt)) + if (migratetype_is_mergeable(mt)) { set_pageblock_migratetype(page, MIGRATE_MOVABLE); + move_freepages_block(zone, page, + MIGRATE_MOVABLE, NULL); + } } }