From patchwork Wed Mar 6 04:08:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Weiner X-Patchwork-Id: 13583361 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 BCC4AC54E55 for ; Wed, 6 Mar 2024 04:16:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id F16DA6B0085; Tue, 5 Mar 2024 23:16:28 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id E9DF96B0088; Tue, 5 Mar 2024 23:16:28 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CCAEF6B0089; Tue, 5 Mar 2024 23:16:28 -0500 (EST) 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 B2EE16B0085 for ; Tue, 5 Mar 2024 23:16:28 -0500 (EST) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id ABB60C04C0 for ; Wed, 6 Mar 2024 04:16:27 +0000 (UTC) X-FDA: 81865302414.16.DD9E42B Received: from mail-qk1-f175.google.com (mail-qk1-f175.google.com [209.85.222.175]) by imf23.hostedemail.com (Postfix) with ESMTP id 1AFDD140004 for ; Wed, 6 Mar 2024 04:16:25 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=cmpxchg-org.20230601.gappssmtp.com header.s=20230601 header.b=ZcxPekAq; dmarc=pass (policy=none) header.from=cmpxchg.org; spf=pass (imf23.hostedemail.com: domain of hannes@cmpxchg.org designates 209.85.222.175 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=1709698586; 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=lMSYidS0AoPvbN6qA3im2YqpbK/tNkyrqR1A6eq5TWE=; b=MOihuVzE1PIhJ1Lk8O6SwIIL8uq97wCfELCePHogDht7E1yecUzUd0nkrLN6qkCIcC1o2U ZlzJuZY5jGBYwGhfz2ep/4+u7hmLl9O5Ca5nVGTwzuN163/WPFKBg6Lao8oTTwPru/mtxU ppuFFbRlL55IIEjuB+BkIxb5soGXJp0= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=cmpxchg-org.20230601.gappssmtp.com header.s=20230601 header.b=ZcxPekAq; dmarc=pass (policy=none) header.from=cmpxchg.org; spf=pass (imf23.hostedemail.com: domain of hannes@cmpxchg.org designates 209.85.222.175 as permitted sender) smtp.mailfrom=hannes@cmpxchg.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1709698586; a=rsa-sha256; cv=none; b=ypdbyoIYVtnvVq4m2uXTjYkVi+L8VJ0YIWWk+DmwahsSDEuplpL19IgOjjWoU/LcMrabxs iwHmP8DTdY0Kd+jOGAuTEHtSQsWlannBJI3uLjyZUo22vSJEK4IG74GAGa5TCH4sphLGYr glipdF/DplHrP6eEn6gYa+oAycfV96c= Received: by mail-qk1-f175.google.com with SMTP id af79cd13be357-781753f52afso447909585a.2 for ; Tue, 05 Mar 2024 20:16:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20230601.gappssmtp.com; s=20230601; t=1709698585; x=1710303385; 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=lMSYidS0AoPvbN6qA3im2YqpbK/tNkyrqR1A6eq5TWE=; b=ZcxPekAqhcV1mbkjaeYK06WAy2HQSFqVYSzNFItRnSB70MIFRbFpYC4UrBl/oRT5gk 0ywGIauiY6Ys4mZYQYp7XLqFpERbY8NFSVdE4SLhjbvFQSHNb47Vm6KqvEIRSDC1ZyM/ 8iQT1xq3MJpz6TsHtbsE3XeTDCBY7kNe1wyv6ZmUqbNdiB78gs9SI3cxGvnfMQ3/qH+G lBqcAaFP/Bh56XfWyRbmhYu9qoB+M98hwUC5o3+kI2+Yy4GaKtn26dVp6V9IOAbs9C2t 4ymTHi+OLiHR24UazCHDzA9CvKWDyE3o5XE/zCwQzIVIAoLzak/mGVMpwSxORl/3Qzt4 DUag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709698585; x=1710303385; 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=lMSYidS0AoPvbN6qA3im2YqpbK/tNkyrqR1A6eq5TWE=; b=HD7pVUMsxjnN1maO29lPCXusPdwtrmdKSdInN7+6xF08UcvQ+hSusdR4u1py/coGsw CD9gQOPvtgUGVEA/eNOij1T1TbyNVQn1Hk93AaC5TTWXq9bbPoFbDKYZAWDHQRn5hiok o0fdpjNw6QmofshiQY0voQnEmLMDr9GyU0GjZHNhDcmQG+WUidAMUFrKUIX7OFBSlaOG DazRDVAmHGRKQQvWRaOMujlOQgrlzian/vcV1UuqKSTyYh2pgtmQml7I/w+RwgjOOyho U215DAoOBhBwvqopdhIOR0Nd7HGo4n4F8ccGhhhJill/hNUFBSc4HWNcbubJt1kYfWyE sQRA== X-Forwarded-Encrypted: i=1; AJvYcCUitTEd+Oy5kwjrrCTm8E62noSpFI5yZf6YN61cU5BZtuOnMHxmZ6vHWjv7zv+fG0g+rFvZDFys0A8bGJvFC0oTNbw= X-Gm-Message-State: AOJu0YxHnNIYmXpq73KCDk0irurtzmO9kgouvL4WQyJiC7Qdie3R/Pzw a3FpNpuJjzP/i/Ryx40A/MFMtM2GYG6lznf0+KTzvuP98oRbf1uVRThTgJd1Z3A= X-Google-Smtp-Source: AGHT+IG6XvS6MFHFJ6jCjiu2kUNS7WFyQEOYG64hXNNhRZh6uxR9igo5+MITru6+zIGSD4f9tY7ZWQ== X-Received: by 2002:a05:620a:389b:b0:788:1f51:5822 with SMTP id qp27-20020a05620a389b00b007881f515822mr3895540qkn.40.1709698585227; Tue, 05 Mar 2024 20:16:25 -0800 (PST) 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 19-20020a05620a04d300b0078838c7acbfsm984096qks.42.2024.03.05.20.16.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Mar 2024 20:16:24 -0800 (PST) From: Johannes Weiner To: Andrew Morton Cc: Vlastimil Babka , Mel Gorman , Zi Yan , Mike Kravetz , "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: Tue, 5 Mar 2024 23:08:35 -0500 Message-ID: <20240306041526.892167-5-hannes@cmpxchg.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240306041526.892167-1-hannes@cmpxchg.org> References: <20240306041526.892167-1-hannes@cmpxchg.org> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 1AFDD140004 X-Stat-Signature: 95zgt161c3fjeww7u5b3f8rhoriwhr9d X-HE-Tag: 1709698585-339609 X-HE-Meta: U2FsdGVkX1+IW1D7f+KaohvsiXKn/RzHrRMc5uhfk2x6hC7NRFDrQxgZ9DmgndCWk49y0LkitMXPUtQm+786r0CCBTq6e4E7Nq+nwowkD/C+PTFD5MGJZvMv8MBa8/YQAP1/LBN5QWdMj5kvYwc5RyMUqgJXb4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=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 3f9ea4c392d5..0f385531e130 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -2666,9 +2666,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); + } } }