From patchwork Wed Sep 18 04:58:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiang Gao X-Patchwork-Id: 13806560 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 AA05DCAC5B8 for ; Wed, 18 Sep 2024 04:58:46 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B3CED6B0082; Wed, 18 Sep 2024 00:58:45 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id AED486B0083; Wed, 18 Sep 2024 00:58:45 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 98E246B0085; Wed, 18 Sep 2024 00:58:45 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 7B4A96B0082 for ; Wed, 18 Sep 2024 00:58:45 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id E3A66C0310 for ; Wed, 18 Sep 2024 04:58:44 +0000 (UTC) X-FDA: 82576653768.28.4F5FE5F Received: from mail-pl1-f182.google.com (mail-pl1-f182.google.com [209.85.214.182]) by imf08.hostedemail.com (Postfix) with ESMTP id 3F161160010 for ; Wed, 18 Sep 2024 04:58:43 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=Ab4fM3Uz; spf=pass (imf08.hostedemail.com: domain of gxxa03070307@gmail.com designates 209.85.214.182 as permitted sender) smtp.mailfrom=gxxa03070307@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1726635411; 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:references:dkim-signature; bh=3elvcLsmZsluZcNvW9TPv7XtWE+ZMD0wypHYaobQ9EQ=; b=3L0wYnx53cu33hVgeepPb3nvOwjtHhD4CpAI/IxxoPAeNNgarzuxRImUO27+lm666iqwMW 1KMNsXJUf5mp0nXISfhzdVVve0hdMAxR5OU6gVqg+wB/nRj9AOHxRVlqgDAo5Hj2Kw3JdY vME+L5Pwcs8wLSMf1lkmrddFB6hhLsY= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1726635411; a=rsa-sha256; cv=none; b=P1Xw10dSEAe4PeGYD9TxsBfyotTOTIGTxTpCP1QYe2spNZuMJBK1BpdJmQhdDSUDDqa7Wv Dt+qAqxW5flAL8dOnYsrqy+HZxNmIsIh8IqjPJf0ILHgYjRjbTEOvnL+PbVM9P1YkwHoFx 0xvfldc2I5+nw4M5lzgNGxPDO87PohA= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=Ab4fM3Uz; spf=pass (imf08.hostedemail.com: domain of gxxa03070307@gmail.com designates 209.85.214.182 as permitted sender) smtp.mailfrom=gxxa03070307@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-pl1-f182.google.com with SMTP id d9443c01a7336-2055136b612so79112705ad.0 for ; Tue, 17 Sep 2024 21:58:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1726635522; x=1727240322; darn=kvack.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=3elvcLsmZsluZcNvW9TPv7XtWE+ZMD0wypHYaobQ9EQ=; b=Ab4fM3UzYgfKQrGl2NopnKWM9m8gP29bHbQOW6kp8+tDGdaBmzl++4wDb5jVcY78aF 9EB5igEqcjBJAemWXcbiinmLM3hNzPIjmRSAPaiNzwrwzIRQ7S6Z1ll9GWtEWsgxvoWM 3z+1+zFMfO9VxwYRDGNZu9iNMIXZxwxhFwIOUey1e1tf3IVYedTqh+Gtt48WLUHoeEAY DcS069QkcxNtbb1zeSAO8k0vW1klaqNTDVLfjFH5b5fBjYz3bpZoTeYAp3NjS62uRnNc CJXQWeMLcRD6rkn3btDjJz0H0jOct9SPFF6tmLLfxYx7y7bFTIYwTXNxVM1NZtGSJ8k5 0ZzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726635522; x=1727240322; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=3elvcLsmZsluZcNvW9TPv7XtWE+ZMD0wypHYaobQ9EQ=; b=eduwHQDADwgcDZFgxO2qUeL95tEmdtVGERBLdS055WUX6ZdTY8ghBunYIJbwSZPeTc EZbjHco0tCutaUBPxgwRTUeU/KhrxtwUf7/zQ4Fizy8iYKlo+Vshq6Y8TlyAwoPvnEGl DyrT3NvIStMAKBhsK/3CbWncvl1/DkoOZ0e2cjYgDU8bYt2Fvf9N0gUErbrsFHGR07x4 jPkE23A25tZoMBRnMi8K/IRMdEfeN0n4Oyt6r4+tU28R/JId7QEJuaQ3t1ctUPephKLZ aW1du3irzHR8/Zdm5+nt50aw0s4seMgwk4DyM7jxoB/YptKhoNib1IiMvfzOXwPf/kdu CULg== X-Gm-Message-State: AOJu0Yy4GJMKa4mbupuS/r2IudM1nX9brPcjI4NVtNXwnTXz0247es/2 xzX8VoeGUGMKwc7zibMbH63vKEUYE4/ipuPx3HbZMTaG7SXsSh9K X-Google-Smtp-Source: AGHT+IEWM55DTS7RQ7ge4nS2Mm/YGbzcC/k1QdWC+lIkgDbts7374x/37/BxicOE0n54aqs+nbf72g== X-Received: by 2002:a17:903:24c:b0:206:b04e:71b3 with SMTP id d9443c01a7336-2076e423359mr359589895ad.51.1726635521883; Tue, 17 Sep 2024 21:58:41 -0700 (PDT) Received: from xiaoa.mioffice.cn ([43.224.245.180]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-7db4998b4f3sm6684369a12.72.2024.09.17.21.58.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Sep 2024 21:58:41 -0700 (PDT) From: Xiang Gao To: akpm@linux-foundation.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, gaoxiang17 Subject: [PATCH] mm/page_alloc: Add some comments for specific scenarios to make it easier to understand why unmovable and reclaimable allocations can steal from moveable pageblocks by default. Date: Wed, 18 Sep 2024 12:58:36 +0800 Message-Id: <20240918045836.10825-1-gxxa03070307@gmail.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Stat-Signature: ugqiqxcu867zytkia1dyo191mdnx6ghw X-Rspamd-Queue-Id: 3F161160010 X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1726635523-17574 X-HE-Meta: U2FsdGVkX1/oyJNRRN9F4o8cWphbem+Yli5ZL/EDMgHmk+aqZvVGktA/M/iycIE/tJWixQQUy4HrsCD9R+y7KxNmZaKI2If+NRKVopY5aYs5BShD9eC3l2wUbZJ4Ah1lzN5xO/8XI9W8R3vpsU1k5JIzmujdL7zpv51EuMXfhHOTjZq8HFrV9gnXxyAflLrnpHDfCDt2AGnHipAtRhPDlxaaOyWN3Sng0/gSNG+XGMeFnJyv7fdMjEe174MF/h69jioCEW3WM63oa7GpGjfKJvscJLZWkLob0uq2wpvH0ij9SrryN5o4gMxfOZpq/JIQzHFwAxw9FZ1KW1JxxQ+VRtZTcsVGhAZoGMqYssXsLnlecILqr2Qtyh2mI/SilRRW2mO1Akpu7RmYxOY+R+5EiEYbD+z5qeW7CkczRTt1D40ysXxb3ETdPCvRR4EjPtKZdoAF5fkNGMK2i4OqckTynCwN48TqM2YORn0jopc0kzLz5r38oUH/v86kCfIewISyOePuvnNxHBJtRaAxAqyWMuvoo9y5ub2lZJkoZrSdxAskj5m+zFAW1/fXj9NuiZdQ3PudVsSbjAUBf2nq5jVY2EpD5DaeVY0Fpgmh9mC4K9Nf1Meuch61HvlL/OUmCd1SMyAGfoL5LWLLZv5BXY5e+i9F2Py/uOJ1XBvG8dOb8LOpd2+0gtcUN7aNAWBpts/yAf/xFO5ha/x2F8M5q44jRgCBajvHJ4xjeegLrVB6kizjicitND1i0TJPUYYaMK9DKNmoupixmV4LSGocwG/vxbLLXfHVJdh3D1Hn+AS81o9Q3xrhV2ui+AJNJW97B9MEfJatvuJJy709pCbFc5QJ9Y5Q/ZWmrxliv2d+Rdu/99A+v3iaSQHyUbcOdhG2QpESKKwhC9cYa6f30oN6y6I5oysLdtOQGV0Bay6Ts6wXGbSk5XF7hA2k7lS4Tc8YLc0brlV1bKo9QguyK0OtDqN jayyIIoP bRlLsaPfqzNxzBOTmBBjb70XIatxrcP5Ye7Zv6/1tUXfmvOMi7af16ru+GY8tQYyl5buQ+pZ5yWgY3st19wSW6y7/uH2s1aa9/3wvFSirwi7s7IQDovCFohYP7cvOMZznWcVqyKoopIPrwxFFgqg6CiS7ykejQIqxV8DkZJ6XpnJ8E4QsWC99P78FgV0DGp1HTLqEb6bMBUcjq5q28hoG2Danx73iKm/LtmLcq12TPvm5nVF6y5Xmlj37hlglj/B3suLCRVycL59YjcAviJpJTlQjbauHlkYyyN3b+iFV+kO1NIm5swS8+zl11v5glsFOKOf8J8c2ERWWuDgO0ePkPktmiuHnTcjtn7VkG/9YcF86WyMuJVTFbYd1uAdhb/A0O0FhBum8DJ2MTTZQTi6mvhdQnD/iWRxn6RCBbyL2ULAGis5YwVOHJGeXsfDXnnwwnHiRdsr0bOEL6P4= X-Bogosity: Ham, tests=bogofilter, spamicity=0.208582, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: From: gaoxiang17 Signed-off-by: gaoxiang17 --- mm/page_alloc.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 91ace8ca97e2..cc8a7a0772cb 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -1818,6 +1818,13 @@ static bool can_steal_fallback(unsigned int order, int start_mt) if (order >= pageblock_order) return true; + /* + * The reasons why unmovable and reclaimable allocations can steal from + * moveable pageblocks by default aside from the above comments, a different + * and better understood scenario is: System initializations are all movable + * pageblocks. If you want to alloc unmovable and reclaimable pages, + * you have to steal from moveable pageblocks or it may fail. + */ if (order >= pageblock_order / 2 || start_mt == MIGRATE_RECLAIMABLE || start_mt == MIGRATE_UNMOVABLE ||