From patchwork Wed Mar 20 18:02:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Weiner X-Patchwork-Id: 13598064 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 163D8C6FD1F for ; Wed, 20 Mar 2024 18:05:05 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 48C4B6B008C; Wed, 20 Mar 2024 14:05:00 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3ED9F6B0093; Wed, 20 Mar 2024 14:05:00 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 218626B0096; Wed, 20 Mar 2024 14:05:00 -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 08EA16B008C for ; Wed, 20 Mar 2024 14:05:00 -0400 (EDT) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id D8A5912010F for ; Wed, 20 Mar 2024 18:04:59 +0000 (UTC) X-FDA: 81918193518.24.B395D9A Received: from mail-qv1-f49.google.com (mail-qv1-f49.google.com [209.85.219.49]) by imf13.hostedemail.com (Postfix) with ESMTP id D2D802001C for ; Wed, 20 Mar 2024 18:04:57 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=cmpxchg-org.20230601.gappssmtp.com header.s=20230601 header.b=UHTqbJ9j; dmarc=pass (policy=none) header.from=cmpxchg.org; spf=pass (imf13.hostedemail.com: domain of hannes@cmpxchg.org designates 209.85.219.49 as permitted sender) smtp.mailfrom=hannes@cmpxchg.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1710957897; 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=30OLZu1BB8NMv+SdqAZeeZ3/L8O0lM0O1+2bSt3RnLI=; b=ChR8v8HHwQ6+omzAdILMZP68L47hh8LxbDiGz4O25EOTQ/zvTOU91NhAbMyUp7IYiqlQ9z WfnxI8VgRXvjT7IudaBgUVS7tfkB8kPiDGF7/Y8cTW08TIyWPvw7z5msbf3aggt738d1zV nOjc9a+NUyPBQJq5g0Tk9BY0ndMYkFc= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=cmpxchg-org.20230601.gappssmtp.com header.s=20230601 header.b=UHTqbJ9j; dmarc=pass (policy=none) header.from=cmpxchg.org; spf=pass (imf13.hostedemail.com: domain of hannes@cmpxchg.org designates 209.85.219.49 as permitted sender) smtp.mailfrom=hannes@cmpxchg.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1710957897; a=rsa-sha256; cv=none; b=V9VGADl3ye7+BXAL7NhOL9iS7FdT9MC5LEtjxgnuaIIJfbluKWE961KQQC9+o4OBADIJmi UERlYGKuc3Y64QHHdCuSyKcYgKze9poZZQRhtLTwx2L885hV7UUxjm6poNi716RDBdNNYo Yi2D6fQUAmAnVjxJPAOmV87J6jU067A= Received: by mail-qv1-f49.google.com with SMTP id 6a1803df08f44-69145fc4265so1104236d6.1 for ; Wed, 20 Mar 2024 11:04:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20230601.gappssmtp.com; s=20230601; t=1710957897; x=1711562697; 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=30OLZu1BB8NMv+SdqAZeeZ3/L8O0lM0O1+2bSt3RnLI=; b=UHTqbJ9j7cWib7AYpk3Y++K9+FTOEcTmqk7J9MTjJBB1KN9u+tJgWYaHA/nZR3pBFw s0XZmgNs9JOj8ZuY85w6wH1wqVBlc+XlKsRQYb5VAdL4LAml03EtKhlvu8VnwTyJLAZT y7ifGukaEc2OfjD/2LGtDGnemd/URwuoupZK1WYNoiTkWGgCGwVeWucPZ1HCv485H1kC NqPtKywFNRcxi1eVy8M2fbLczcTHZt5PPEAo5PB0xAOsS1Dd10u5J6iIATfxT41l11Y+ Yw2ay0goTeAPgWBkSqc98pfC4ytFFoxLhVVhLf46hrsCUGYfrKrVLiEBwTXGdhhqp7K2 fzAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710957897; x=1711562697; 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=30OLZu1BB8NMv+SdqAZeeZ3/L8O0lM0O1+2bSt3RnLI=; b=IpDJGdUwFoeVl6n7i/cwJUvLLJnn/itAA98k4WUSwhDUirX0M/m/d84YTLssGa3yzx XFMZv0mKp4PVBMxtEG9u6TqJBWdqvgN62Gu9utTpXXxXhalP/W5gJAs1mxipE+ws2RtW LM1rG37vWJ/O3r+j8OtzuIPTGRJWK00ko0kg3MvRceW5cXPDi2Xpm53pZ34Xg+u264Xk 6GoImIyeiWlJtvO+2dgsc4IGKuqAC5iN3/AZVGnxLc/G6DclUZOc8AcGqAvqKgx54ccV heJ91rCTETKF3lbMzEj/r0rGJIOgwY4W/fSUk4SCG1hiWtKBBff5gXVTzHpf9R1XmltR q3RA== X-Forwarded-Encrypted: i=1; AJvYcCVFdLSwDh/yWuYRP4rJX5al0eQU8cqRfrEa6/B6bV8Qp4SGhSkHdjuYRglxLq42qFOEM+utsrDdFr4tE+yo1m2Fm2A= X-Gm-Message-State: AOJu0Yywu/6Kxfhc+insFQuUt5RQSWOeAuuvssi+kH20VSv297h1yypi Y+5eM+Pj67p4cu0yg7m7qGpFxqzduhDLysM64hWmjZinelkTKB8unDJRy62dWGY= X-Google-Smtp-Source: AGHT+IG5sxaRbIJ5O7l1kuKbDMw7LMa+PdnsbFz8dadgYPyg3jWsjDbKYtsMujG8RnvxMdWfiNyJxw== X-Received: by 2002:a0c:f64f:0:b0:696:442c:a659 with SMTP id s15-20020a0cf64f000000b00696442ca659mr3116723qvm.52.1710957896840; Wed, 20 Mar 2024 11:04:56 -0700 (PDT) Received: from localhost (2603-7000-0c01-2716-da5e-d3ff-fee7-26e7.res6.spectrum.com. [2603:7000:c01:2716:da5e:d3ff:fee7:26e7]) by smtp.gmail.com with ESMTPSA id 15-20020a0562140dcf00b00690cbd296fesm8183030qvt.121.2024.03.20.11.04.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Mar 2024 11:04:56 -0700 (PDT) From: Johannes Weiner To: Andrew Morton Cc: Vlastimil Babka , Mel Gorman , Zi Yan , "Huang, Ying" , David Hildenbrand , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH 04/10] mm: page_alloc: move free pages when converting block during isolation Date: Wed, 20 Mar 2024 14:02:09 -0400 Message-ID: <20240320180429.678181-5-hannes@cmpxchg.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240320180429.678181-1-hannes@cmpxchg.org> References: <20240320180429.678181-1-hannes@cmpxchg.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: D2D802001C X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: 9d11q7nws4ybtmu4ibdiod37wj1yqyte X-HE-Tag: 1710957897-53943 X-HE-Meta: U2FsdGVkX1+qfcApUjN+8Cvl0gef2QMvxeg/CMn0WnNfE/PC21EtqDr2HcKdGnxIHF8xMr3P6gl+SZIVGCzC9dCLJyu7153ltTCJJcrlp25LWacUZgkN5cFfB0IvGDczF8pYuI8ZA9WsCBHARAwf7xtkw7PyJ/lCenbBVfU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QUxRxmFbSauJCtxyI50ssAunYXHVpS3brwGV9GQFtHqMTJNd/wuZlehJyp3BAn1bt1Uym2VDeZnRRvm/og4YCEH5EI+GfBAo2r44Ac+/ItpERzSz9AOVlVwFWXgNsfowfNsyMPOk4R7Jd15qyYcDNysmveBR+asxYbwYAy4et8qwwcnl1flPIDn3kxuHcfOFqr203aRfTOtbpcD9Ed4+7UfbOmnouxoDAUpgsMu1L8bQaocTRnaj/F5kqBdCgcdrdCOGtK8tdoiBjN9CNMuaDYvBSOKiZGNKkN8ATfxaWeAfnDF3rLMkwup6xLfuYcLFY2w+/dxF1GMxg== 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: List-Subscribe: List-Unsubscribe: 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. Reviewed-by: Zi Yan Reviewed-by: Vlastimil Babka Acked-by: Mel Gorman Tested-by: "Huang, Ying" Signed-off-by: Johannes Weiner --- 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 4529893d9f04..a1376a6fe7e4 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -2683,9 +2683,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); + } } }