From patchwork Mon Aug 21 18:33:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Weiner X-Patchwork-Id: 13359741 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 53256EE49A5 for ; Mon, 21 Aug 2023 18:37:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AD6BE900008; Mon, 21 Aug 2023 14:37:51 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A8380900005; Mon, 21 Aug 2023 14:37:51 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8B0D3900008; Mon, 21 Aug 2023 14:37:51 -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 71662900005 for ; Mon, 21 Aug 2023 14:37:51 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 398E91603E3 for ; Mon, 21 Aug 2023 18:37:51 +0000 (UTC) X-FDA: 81148970742.23.FBB9CC7 Received: from mail-qv1-f45.google.com (mail-qv1-f45.google.com [209.85.219.45]) by imf16.hostedemail.com (Postfix) with ESMTP id 69247180013 for ; Mon, 21 Aug 2023 18:37:49 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=cmpxchg-org.20221208.gappssmtp.com header.s=20221208 header.b=tTKq6l6a; spf=pass (imf16.hostedemail.com: domain of hannes@cmpxchg.org designates 209.85.219.45 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=1692643069; 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=ZngYrrpTqTVsoxTWaftFpu0t3D1kL65SFXqeVP8LffY=; b=rZ8XXHxueL26MNPDi1wh++otCkyHAslWgbH0BCOcV8EdnDbvy2EvfHIoMLkj+Nu8CFBvLI PhN1L4ZOsJFhBeA637vYz3eP43isTAsfPd7nn9GVSNOvPp/kevbcQOiH3nyjO5RPINxMRn s6kyrv1lfGn9+We3Lg8fTz4bxNSGP5k= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1692643069; a=rsa-sha256; cv=none; b=ypnY1B4jMqCdqpm0QWVS5bcDBEPHgwt+JS9FgB5mhw5s/Oj9G4pH2W7l8KFfoF8aFmrBKl oX3BBKLjuKYuk5au+GpxvVdxsxyiUklpoCf/BViDXtYxOTQ0aG2KgC2fjmQgWZIEui5cHV Vft604WmzQhu4n9Loz3wdj0d8YfJy9E= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=cmpxchg-org.20221208.gappssmtp.com header.s=20221208 header.b=tTKq6l6a; spf=pass (imf16.hostedemail.com: domain of hannes@cmpxchg.org designates 209.85.219.45 as permitted sender) smtp.mailfrom=hannes@cmpxchg.org; dmarc=pass (policy=none) header.from=cmpxchg.org Received: by mail-qv1-f45.google.com with SMTP id 6a1803df08f44-649921ec030so22012716d6.1 for ; Mon, 21 Aug 2023 11:37:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20221208.gappssmtp.com; s=20221208; t=1692643068; x=1693247868; 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=ZngYrrpTqTVsoxTWaftFpu0t3D1kL65SFXqeVP8LffY=; b=tTKq6l6aHUSFxqQAsy9JwsqI5eXHQGdiD0FODZRCZUUeuFzk7B/PGOmI2Vs9szLK+G dEC4uoaY+bYkZk7tXrTTN84Ya1UWN1T1ntmz4BwiWpAaTDv/KjLtiU8xN7cCLXugYnxj LJbOr/gs/OUqybReoZoBcLxK7V0Pt3TD22y3t7PTjTmBG3+EYcaWeiiG5KKdHp8G7xu4 gGQs8hxtzZGVFfnPYT9iv+Ahh/wRyldbmPvTOfU+kCq2MYvvfryQ4MlloTXLfKY2VBzt kO8BdLOxDu9kD/rqKeB1BSsNV0xnrL1jQgNg74XoHP6TFhE2QWb0o5caPuzLs4GeMiZG eWpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692643068; x=1693247868; 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=ZngYrrpTqTVsoxTWaftFpu0t3D1kL65SFXqeVP8LffY=; b=i9cT52IEBAVGGoq4dVyIxOjWAjIR3XWSv9Ko3EYDQaZYK+0Jii3GWUWab0weaeNp68 7S3YtGcWX5FIfqFCw1fTePe7dpYUMwOehBFX0FlYPRtdyncBEz4jb6TlcLzeac00yReq ozMSbBJpuOx1CfrTuFwDIpWrgJO/fyCERqfXoJISJMuLd0SYEJOrf7FvcaXG3nmfCTgI hSZ16zH0Nwc9z37rhKDNUkgbdgxSy4wQa4yeFbewNQvgHMF/G54oFUa90yLLLn9jxW1Y XXbGftdUmU16SH6EAr1S4VjA9TqkZqAqRYpUQcZnU9qHyTxjiRdevRT/xYDpuVSFLkDi Ifvg== X-Gm-Message-State: AOJu0YxojZftUeE5j7ajA9mWHwrGweiuRAAi/nargPswg/0iVkwCxecY lVb5dD458Ub4pnMn2laFZhMFpA== X-Google-Smtp-Source: AGHT+IEE9dNMT5yZrqH0G+cbatGuZK0wFc+nYEOict7vJbVhdu8eLSChdSchtQ2QFxRxmtKi+qryTw== X-Received: by 2002:a0c:f092:0:b0:63f:bf70:678f with SMTP id g18-20020a0cf092000000b0063fbf70678fmr8857363qvk.59.1692643068549; Mon, 21 Aug 2023 11:37:48 -0700 (PDT) Received: from localhost (2603-7000-0c01-2716-699c-6fe1-d2a8-6a30.res6.spectrum.com. [2603:7000:c01:2716:699c:6fe1:d2a8:6a30]) by smtp.gmail.com with ESMTPSA id h16-20020ae9ec10000000b0076cc7219ac9sm2650582qkg.7.2023.08.21.11.37.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Aug 2023 11:37:48 -0700 (PDT) From: Johannes Weiner To: Andrew Morton Cc: Vlastimil Babka , Mel Gorman , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH 5/8] mm: page_alloc: move free pages when converting block during isolation Date: Mon, 21 Aug 2023 14:33:37 -0400 Message-ID: <20230821183733.106619-6-hannes@cmpxchg.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230821183733.106619-1-hannes@cmpxchg.org> References: <20230821183733.106619-1-hannes@cmpxchg.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: 69247180013 X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: mhqjasqiskm3r8d7u169uoq6rm4cc5wz X-HE-Tag: 1692643069-681815 X-HE-Meta: U2FsdGVkX1/GQzd0mcnwW0CE3SRg7w6m4d8yVgAPnDg8PAxGiMB07HCuUnlWsX9+UdTRY4+/iMT5JlhqLAs18ZwsDal6CWliS4Jc+1erBXRiyGQnktRvJ8ZOfjFMt8P6xORj+cXGnN+rIqSqyhM975F6yJaUwfUvJBddJnlr+giYwr5mxMzLW7uxzOOKilIu6KcRehm5bOXjuprs6NSPslMCVoU/h6+cKqJ1dWWuT2tVKCudvgN/93tX2vftSK2DSllkb11lBCPyYzyEIGOrx033rz+ITSkx0+Rs7AJvzKWbddzzY9y6cu2BMBNbdcWiWS5X++bj88vXDO1Xx2EjduyMydbAOnCd2/RqAmQV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N6FLgp+dNlpWVYmKG7wPbXcVof4WnKFMXcNoe41ZuaiAZRdkfRyc= 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 --- 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 6c9f565b2613..6a4004f07123 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -2586,9 +2586,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); + } } }