From patchwork Fri Dec 6 09:59:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 13896801 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 B18B6E77173 for ; Fri, 6 Dec 2024 10:00:04 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 40EBD8D0002; Fri, 6 Dec 2024 05:00:04 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 3B8EB6B0204; Fri, 6 Dec 2024 05:00:04 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 233E88D0002; Fri, 6 Dec 2024 05:00:04 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 04C796B0203 for ; Fri, 6 Dec 2024 05:00:03 -0500 (EST) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id B82E842DEC for ; Fri, 6 Dec 2024 10:00:03 +0000 (UTC) X-FDA: 82864088160.14.0F88ABC Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf29.hostedemail.com (Postfix) with ESMTP id BF7CA120015 for ; Fri, 6 Dec 2024 09:59:37 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=XcPE27uN; spf=pass (imf29.hostedemail.com: domain of dhildenb@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=dhildenb@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1733479183; 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-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=OHFxPv9O3q7cC5DJx/fwSJeTT3u7bfbiSrofwZ2W0U4=; b=LQXzLEc8Dwq8GCnIx1k6KN1U3awaG6Vt9byvkhWwP47h8tJh7fg4yhMigxzM0rSHnD30gQ hB4vS1YJRiPRsZYsntTOaD5PwgtgixaDeS9hocwXTaZkX1WdHFJv94Q5a+QUPM1THCwYLh bxN6t7Xd+oNtGNNCvELBpGUHo9VVMfs= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=XcPE27uN; spf=pass (imf29.hostedemail.com: domain of dhildenb@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=dhildenb@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1733479183; a=rsa-sha256; cv=none; b=Elo+81PZNgDjpCzs3Z8RF7mpT7ZvA1JhVemJoKSwMwJZpLv4Wgfm+Bpmw5XjoBZ6MBPIvc 5sKJ8YXAmgequqVKBe2t2RwshX0zxTrOFEsPub8D3oubXfIkPoAEG55ERacd9ZYzeSecEv Db+iFamTrobNON7talcxx1YYOxt2YsU= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1733479200; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OHFxPv9O3q7cC5DJx/fwSJeTT3u7bfbiSrofwZ2W0U4=; b=XcPE27uNC4/b6DjJHmyeq4hEvbMpYnGtxcGjMZUABxalUIvhOkYHULgucZTm5z74LiXWQC uNVCKWY9GBRPVidCsvHlZOCLIuB8WfwZE2EFBO2KsT1CaBs2hkTPEnA1zkTXDhto+uZMYu LY5qdPIhzez/UjQLr/+R+xdbWbNe/Ew= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-569-qeN-yu8DOxCS6-u2x_pZqQ-1; Fri, 06 Dec 2024 04:59:59 -0500 X-MC-Unique: qeN-yu8DOxCS6-u2x_pZqQ-1 X-Mimecast-MFC-AGG-ID: qeN-yu8DOxCS6-u2x_pZqQ Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-434a9dce888so10526345e9.0 for ; Fri, 06 Dec 2024 01:59:59 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733479198; x=1734083998; 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=OHFxPv9O3q7cC5DJx/fwSJeTT3u7bfbiSrofwZ2W0U4=; b=jwXN28Ig9IQoFgkJ8Ig7xE0kfZxk/78Mia4xG7bCoLA9ELhMvS4yjQDSJ7ChZ4JQo8 PH4wV4yVkh9Uj4FtXakilI88vZKqBU//Yf7XFauw2iH5U8R4QuWknMOf6rf3qF5rQpN1 oTg7w89ywTvDcbWVn5b89O0aJPxxJOtD+uY+W7O/Bsp3KIEdgKRt3iv3/SJXEysWM9J4 BSA3XGzPKUWAYqFItHL5wt4uSqyLiGKSjkMxuis6lOgmTgbIO4gat3maZpj4RvBun9i2 GyS8jaUfegT0mpwOvuVb8PEyf9VNbJrPJ/zmgPlDUY5AyMNY1le94ZFWjo6GjUAQU7TH dLkw== X-Gm-Message-State: AOJu0YyGilsNJHTDyq0/+RQCfMrXbo/vxfLUU6bbXOZAQnoiOMShmRvW wTekgxKzfSsE4rtHxwo2AloSUClxhL/kihX7+Lg3mznyt2ty6KduPfcQPHFjua1p2uP74NrNUta U2sSPaahq3iAxz8hFWX5UHd9Uzvt2jCb3He93xpn7mgsM+ZHD X-Gm-Gg: ASbGncs6DkVtbya5YHTK7w5Ju0TB0kjO/3mM7cZxlM5Nsg2Msvca6t3C2xnipoEeZsr Pln78aA8AAbCLtWjGN6BzTYjB3mTAdHct8mas8NrGHnRa57Q1raa7GxQsyDJe0Lk6YhFcpwILQt wxYUUrmvEtfNpVqDnRw0pcSfQamdhZyOXCYIOLUTJuE+MUAk54pU9HVOaUVh9W8c7JodusQjUL+ /+SGDjWIEHvYcw7YHa3e1Hp3rapa4lXaDVdOC1PrGt1k4X2zWfavrKtV9Pvh1nx1QZ+94JwVduu rvoK7MqJHdNfEqtGFVOmJ3WQuObppkZYAbw= X-Received: by 2002:a05:600c:470b:b0:431:52cc:877e with SMTP id 5b1f17b1804b1-434ddecfed2mr18057145e9.20.1733479198199; Fri, 06 Dec 2024 01:59:58 -0800 (PST) X-Google-Smtp-Source: AGHT+IFe5tufop43b05VWxmmjhji+VfNWJUbfs4BReG0q0hG+8wMTpPLAIMsOI9sLBE+lqFnBAZ94w== X-Received: by 2002:a05:600c:470b:b0:431:52cc:877e with SMTP id 5b1f17b1804b1-434ddecfed2mr18056965e9.20.1733479197845; Fri, 06 Dec 2024 01:59:57 -0800 (PST) Received: from localhost (p200300cbc71bd0001d1f238eaeafdbf7.dip0.t-ipconnect.de. [2003:cb:c71b:d000:1d1f:238e:aeaf:dbf7]) by smtp.gmail.com with UTF8SMTPSA id 5b1f17b1804b1-434d5273199sm88616395e9.14.2024.12.06.01.59.55 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 06 Dec 2024 01:59:56 -0800 (PST) From: David Hildenbrand To: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, David Hildenbrand , Andrew Morton , Zi Yan , Vlastimil Babka , Yu Zhao Subject: [PATCH v1 1/2] mm/page_alloc: conditionally split > pageblock_order pages in free_one_page() and move_freepages_block_isolate() Date: Fri, 6 Dec 2024 10:59:50 +0100 Message-ID: <20241206095951.98007-2-david@redhat.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241206095951.98007-1-david@redhat.com> References: <20241206095951.98007-1-david@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: 6HuT9xZ6LX1OVyPI168kNZ0nxeX-uJcg8YTLzfhPsZo_1733479198 X-Mimecast-Originator: redhat.com content-type: text/plain; charset="US-ASCII"; x-default=true X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: BF7CA120015 X-Rspam-User: X-Stat-Signature: oqbj7e1guxte6sn9xjuonabq69dghbtg X-HE-Tag: 1733479177-320964 X-HE-Meta: U2FsdGVkX18qGXFPmKNJ0xyfE3/cHLz50jBXAV2D9cck2S+PntWV6zuTSTr85BiPf5VX9c8lSsaWi0hXfbThVF4cgSKc9FY0Ss6/Nw1yjbG/Qm1hIbPeSrxAvewIrfNf4RDVfAya9XTxsFTZoGaVfheHarsqI8PSEO/uSOow3EU9C3apV0fZPgxq0h9wH5R+69dj8JJ4SQ1GujfgLNuBuL4sLHIpdWWiscitPQHBHHtz5rjm5t8yYA3+hcH7OEJHisTYxOqo3lLpkNepC1OwkWE9mA7D2RiI++XGKx+eh71ll0ybfE1q6nQ8AnZAbGH/dl7zEQSsdbofK2CH4dE3gxEzaikPh8V/1M9JEij2IDM3H1T8MNCcFYNMZ25+KBcCXtgiJdxPGKkrezO644VRLdKVOvE+BotFFKa51iUl5GSIw3lCsAD2ZFVL+TC9y6qbI12GW/YG3SBTk25tVaBe5+RHZ7YxJvKBpeXjwqL1eMC3+ZvsMwL994uEL0FrOXfDphoIHtlXh4V0aX63V+VmycfTSD+DtxtKu0rRIBt3QzzXz3f8RLbNtA4GM49Ma3A6GMTHUycnYNeIQoCW0nAtMj5J6qVdJatWF2x+W0TwSx35wIqFv0HFAqm7IqzfBKg+UVjlVbRUp5fUkaP9JYtglSe0NZDz7mfPfxaCwXspSSUJQnbSTQsprNUJHcgDlsMmiTiXwuujxOsmuCA1Q0TSA2lOGPmaEKeXUgZx1m/06QRNcqPmXHM94gC0tN0dASQ6Fg9E+YYu+hnwRBrVqhKhLf34F8shhARDvPkrOh9bG5g3UkH94h5q2/K1BO+3VOWBni21PsKVp/26xwGgWBDaWH5CUxMWSJ8AxaIpLe1c4l7zpW+JaKwN8cnYHz+Mso6A9EEngc5inuNJTiThL8+RL9BAJ+pJIhHZAb+yTBLQfPGFEfg10omuWdE72cvD8pWR6HB/udzxJNvorNxE6zC zKqoWYvB H76AyVFLw4IQ/Kuv4CVnpsotWCK53LWc9yGFC9rQfyRIIpQl4tDcQ4LTN0yyA9rYI9TbbosKU/gIerM1vMtaUkDLPeR3xMUiBa/yQthZ6rpVP/1vNWm288quTMtkq+cdVcPkygRsbLsWzADchr3E089x0XLne9yryshAZRcZP98/4PKPnuArlqfXYtCYBfA86sAn2e4/3B6qYzK4ICD83riR/LX2/PwuhVr0sfqucShzgy5U39dwxnXn2UovD+r704ADr88OvFwjQgjXahzfDtOOOoY5A5p7/oKDNCnfCR3P5dzCpsiWDwShmG6ZB6umGpHYYHdXbRRQEvABjxctPF6+7snAMuvUUy46sM1EDWPfHNMt4GOx1s5UEQ49EVTPX4X3oQah/sBTm3VhPMd6RPKZnXrhdxkWv6RxEzAmTp4VTdvu2EFfRugJu41QinIOO2sk2z33OF+AoMw4BcstfrYx7O14sap5cS/gW 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: Let's special-case for the common scenarios that: (a) We are freeing pages <= pageblock_order (b) We are freeing a page <= MAX_PAGE_ORDER and all pageblocks match (especially, no mixture of isolated and non-isolated pageblocks) When we encounter a > MAX_PAGE_ORDER page, it can only come from alloc_contig_range(), and we can process MAX_PAGE_ORDER chunks. When we encounter a >pageblock_order <= MAX_PAGE_ORDER page, check whether all pageblocks match, and if so (common case), don't split them up just for the buddy to merge them back. This makes sure that when we free MAX_PAGE_ORDER chunks to the buddy, for example during system startups, memory onlining, or when isolating consecutive pageblocks via alloc_contig_range()/memory offlining, that we don't unnecessarily split up what we'll immediately merge again, because the migratetypes match. Rename split_large_buddy() to __free_one_page_maybe_split(), to make it clearer what's happening, and handle in it only natural buddy orders, not the alloc_contig_range(__GFP_COMP) special case: handle that in free_one_page() only. Signed-off-by: David Hildenbrand Acked-by: Yu Zhao Acked-by: Vlastimil Babka lock, flags); } -/* Split a multi-block free page into its individual pageblocks. */ -static void split_large_buddy(struct zone *zone, struct page *page, - unsigned long pfn, int order, fpi_t fpi) +static bool pfnblock_migratetype_equal(unsigned long pfn, + unsigned long end_pfn, int mt) { - unsigned long end = pfn + (1 << order); + VM_WARN_ON_ONCE(!IS_ALIGNED(pfn | end_pfn, pageblock_nr_pages)); + while (pfn != end_pfn) { + struct page *page = pfn_to_page(pfn); + + if (unlikely(mt != get_pfnblock_migratetype(page, pfn))) + return false; + pfn += pageblock_nr_pages; + } + return true; +} + +static void __free_one_page_maybe_split(struct zone *zone, struct page *page, + unsigned long pfn, int order, fpi_t fpi_flags) +{ + const unsigned long end_pfn = pfn + (1 << order); + int mt = get_pfnblock_migratetype(page, pfn); + + VM_WARN_ON_ONCE(order > MAX_PAGE_ORDER); VM_WARN_ON_ONCE(!IS_ALIGNED(pfn, 1 << order)); /* Caller removed page from freelist, buddy info cleared! */ VM_WARN_ON_ONCE(PageBuddy(page)); - if (order > pageblock_order) - order = pageblock_order; - - while (pfn != end) { - int mt = get_pfnblock_migratetype(page, pfn); + /* + * With CONFIG_MEMORY_ISOLATION, we might be freeing MAX_ORDER_NR_PAGES + * pages that cover pageblocks with different migratetypes; for example + * only some migratetypes might be MIGRATE_ISOLATE. In that (unlikely) + * case, fallback to freeing individual pageblocks so they get put + * onto the right lists. + */ + if (!IS_ENABLED(CONFIG_MEMORY_ISOLATION) || + likely(order <= pageblock_order) || + pfnblock_migratetype_equal(pfn + pageblock_nr_pages, end_pfn, mt)) { + __free_one_page(page, pfn, zone, order, mt, fpi_flags); + return; + } - __free_one_page(page, pfn, zone, order, mt, fpi); - pfn += 1 << order; + while (pfn != end_pfn) { + mt = get_pfnblock_migratetype(page, pfn); + __free_one_page(page, pfn, zone, pageblock_order, mt, fpi_flags); + pfn += pageblock_nr_pages; page = pfn_to_page(pfn); } } @@ -1254,7 +1280,24 @@ static void free_one_page(struct zone *zone, struct page *page, unsigned long flags; spin_lock_irqsave(&zone->lock, flags); - split_large_buddy(zone, page, pfn, order, fpi_flags); + if (likely(order <= MAX_PAGE_ORDER)) { + __free_one_page_maybe_split(zone, page, pfn, order, fpi_flags); + } else if (IS_ENABLED(CONFIG_CONTIG_ALLOC)) { + const unsigned long end_pfn = pfn + (1 << order); + + /* + * The only way we can end up with order > MAX_PAGE_ORDER is + * through alloc_contig_range(__GFP_COMP). + */ + while (pfn != end_pfn) { + __free_one_page_maybe_split(zone, page, pfn, + MAX_PAGE_ORDER, fpi_flags); + pfn += MAX_ORDER_NR_PAGES; + page = pfn_to_page(pfn); + } + } else { + WARN_ON_ONCE(1); + } spin_unlock_irqrestore(&zone->lock, flags); __count_vm_events(PGFREE, 1 << order); @@ -1790,7 +1833,7 @@ bool move_freepages_block_isolate(struct zone *zone, struct page *page, del_page_from_free_list(buddy, zone, order, get_pfnblock_migratetype(buddy, pfn)); set_pageblock_migratetype(page, migratetype); - split_large_buddy(zone, buddy, pfn, order, FPI_NONE); + __free_one_page_maybe_split(zone, buddy, pfn, order, FPI_NONE); return true; } @@ -1801,7 +1844,7 @@ bool move_freepages_block_isolate(struct zone *zone, struct page *page, del_page_from_free_list(page, zone, order, get_pfnblock_migratetype(page, pfn)); set_pageblock_migratetype(page, migratetype); - split_large_buddy(zone, page, pfn, order, FPI_NONE); + __free_one_page_maybe_split(zone, page, pfn, order, FPI_NONE); return true; } move: From patchwork Fri Dec 6 09:59:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 13896802 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 D214AE77179 for ; Fri, 6 Dec 2024 10:00:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2D3086B0203; Fri, 6 Dec 2024 05:00:07 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 1E8856B0204; Fri, 6 Dec 2024 05:00:07 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F06776B0205; Fri, 6 Dec 2024 05:00:06 -0500 (EST) 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 C43826B0203 for ; Fri, 6 Dec 2024 05:00:06 -0500 (EST) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 6DD84C19AA for ; Fri, 6 Dec 2024 10:00:06 +0000 (UTC) X-FDA: 82864088244.29.E6B55F7 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf26.hostedemail.com (Postfix) with ESMTP id 869A6140019 for ; Fri, 6 Dec 2024 09:59:51 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=IUqrpUpR; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf26.hostedemail.com: domain of dhildenb@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=dhildenb@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1733479196; 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-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=IA4ZMoyJsW9kk7MRivWjZHMd3/6CwxZEtrg2OJXZFBo=; b=upW8Ubo+wL/iMINLxUVgo5/FgxrW4SRQlZhwE4vv6KDU/9QIfZ2OGZ5OBmA6OSISSm1wSt iHygdxPOcqHxStVmEwIedK+l6WQYW5JibwkHvTryaXlQBlVzqIjb4H9M/Q+5ICFrFWImeF lPhuw4zEcs2jClQD2MWQnbgP1PXazrY= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1733479196; a=rsa-sha256; cv=none; b=smKIgN0wgt6aMudVe+xvkPrXMCEEM7kC7DSEW8ymYJXR8rED+5iv8naCv4Zm/qsNooYIi0 4ZOTQSWs49r+xSZXxJml5JaGNn54vkkh0g91Xze7oRaxhIXxBvzF9c2o64yZ3vNMWNgLnN phyMvoqbqhAb8NLgQkQovrzclBXZn4M= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=IUqrpUpR; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf26.hostedemail.com: domain of dhildenb@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=dhildenb@redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1733479203; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=IA4ZMoyJsW9kk7MRivWjZHMd3/6CwxZEtrg2OJXZFBo=; b=IUqrpUpRHlk25XpUpCt9vOhTdT3X6PNB0uWg8PwjzTy8O1mXGodW/q4Vhyvj+koBZoO45r K1VSEW8tECZYbFFt0e4tEBEAySUaMQkxVWNvmdkDhy5F0svKneMAvtH8noRqMy0q9LCa15 tTY5xdyhEJ7gbsClTINwYhT81tGlFDU= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-240-aComCGu0O3CTx0qvGBNqzQ-1; Fri, 06 Dec 2024 05:00:02 -0500 X-MC-Unique: aComCGu0O3CTx0qvGBNqzQ-1 X-Mimecast-MFC-AGG-ID: aComCGu0O3CTx0qvGBNqzQ Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-385ded5e92aso751619f8f.3 for ; Fri, 06 Dec 2024 02:00:02 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733479201; x=1734084001; 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=IA4ZMoyJsW9kk7MRivWjZHMd3/6CwxZEtrg2OJXZFBo=; b=HrN0HEfyod50rtIF+mFkViKL0sIszRiQT6r6XR2pVPWiJamwV2UGJx3IUIbMtvQfEZ IVDfhR8lhlh5tzIio9su20msF3dSIK+cMvQbO+yIjNtjd5ntwjs2iDHi6aDauM1xTzqE fPqNY5CXQYJaKHslRMROJy7A/xrbBMT/4HsvXw64T80euHSPtPsI310CilG84KzOwnKI 9iz+Z0uqfJAPF+hUU4pb4kDpuMURQ1nXYY7XV/M6doC98bBdrWZinW4SyvpTOTPKeysz EyH1ykDSkPFG2W3Z/VFNYRpqyiYjAxyv8gt1s28XbnDYfAxYBVbwv780n+FVbLJJbXux ch6Q== X-Gm-Message-State: AOJu0YyGmigAmuYfUokb3GJ+L4lttYNHBoN9uszmttHDwtXHGK+FTwm9 cb7/KnHkso+UCb91Qfaeo5AFkH52iw4PgTz8Cgivi34EFrjWk4wOaicLRmpIewIOp9Svd4+eGz8 ytiT/tq0KXdtOtVRejsToTWxFQjxpZHBLYouYyqkKUk61Gtp9 X-Gm-Gg: ASbGnctiDhB/H9bRbxLpBZKbPnsXz2M9FLyK04YlkDrranRn3NoL6dNkcg9hY3QEjDG CLbPL5xea9NQIUx1UsTWbsXLv9anEShgHd1APguADvbxmwZgwXDL/R7oPDpYmJMKb7peKAw5rUh xxpSaP9rDlcOLR7zAx2eGDQpatZRBrIMQLs6ZOa5DnVtGkKEKBhoEtInTX4JL6Xr80ol8vaJDJ8 xG/J92SVnHBrVcGmyvy5llmSHSEZX6waQKzAXiPXs/pUXwQMP+V7s/S0zkE0dpZN0YuhEMle7M2 b0GjwML/sqJWhzZVLyNyw/Ji2dDcp/3G+88= X-Received: by 2002:a5d:64ef:0:b0:386:2ebe:7aeb with SMTP id ffacd0b85a97d-3862ebe7e3amr588703f8f.44.1733479201186; Fri, 06 Dec 2024 02:00:01 -0800 (PST) X-Google-Smtp-Source: AGHT+IFS7q3Y3cr64iMaChXRU6kWOrDr/y/KtXu/TH4x76fjE0yJJ3g/J9U0CFiziA1wkJGitb1OUA== X-Received: by 2002:a5d:64ef:0:b0:386:2ebe:7aeb with SMTP id ffacd0b85a97d-3862ebe7e3amr588688f8f.44.1733479200834; Fri, 06 Dec 2024 02:00:00 -0800 (PST) Received: from localhost (p200300cbc71bd0001d1f238eaeafdbf7.dip0.t-ipconnect.de. [2003:cb:c71b:d000:1d1f:238e:aeaf:dbf7]) by smtp.gmail.com with UTF8SMTPSA id ffacd0b85a97d-3862e3fe716sm769370f8f.7.2024.12.06.01.59.58 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 06 Dec 2024 01:59:59 -0800 (PST) From: David Hildenbrand To: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, David Hildenbrand , Andrew Morton , Zi Yan , Vlastimil Babka , Yu Zhao Subject: [PATCH v1 2/2] mm/page_isolation: fixup isolate_single_pageblock() comment regarding splitting free pages Date: Fri, 6 Dec 2024 10:59:51 +0100 Message-ID: <20241206095951.98007-3-david@redhat.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241206095951.98007-1-david@redhat.com> References: <20241206095951.98007-1-david@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: Cq58PvbwQ2c56rTKUG3fcv25GICekV0a1LbyPnB-dSI_1733479201 X-Mimecast-Originator: redhat.com content-type: text/plain; charset="US-ASCII"; x-default=true X-Stat-Signature: a8grpqqw8aoemcoznjyoaa79fdduaetm X-Rspamd-Queue-Id: 869A6140019 X-Rspam-User: X-Rspamd-Server: rspam01 X-HE-Tag: 1733479191-172180 X-HE-Meta: U2FsdGVkX1+uyBl18WbY9zHolBo8f4gCEMjBzVtuM+oyGFE4H0DDhLvWAjkRrBHMNayLD32VNiVwrEDUpZ6Hv3jmAcfwP3qWB0Oi2/tFhEG7y7Wldzw+CeVZejaY0zwbXxBOqx40oDpOQozV2kyUjh7UjVSeXroibuZLyI9KdvwrvEg6X+lA5OXq4gB9lUQ5TWJdPuXxBWiQ7YZkoL1UOQR1nyAPOb6+YSeExdQHuMOmWh2fo/e3oZ60caNC5Fqlc6nSoEkLUagb12Z4TnqhTVgOF3wUVQUM1OhwN6aUYpjNJ7HVNj3wXlXJWBcb7QBmboYTX6VYPHMmJ3zaGDAFfwbTvmReh40nQb0ZXBavTftS33jSzgsD3gFvfKmNyXes2S3lpYxf+dR+LYaeJAxEP/qEWX1Rsb5/YhM/l2Zlh+NtjUm2QV6OpvcR2XWffpy7wn9Ce0NZtaleVmbKO/bye6i1qtIYC2IxBgboZIEggIs2GG7iKmhC9WpjhJ8lkDRp/PC3eg6Wx7PtjmwqNIwHOHfJa1FgsW1SCTA0qr1r3cT1YrCjGXgx9ywBsftY+Y83UNTZcUJ9Hl5XxD79vrLB6wJgPpH4mfb/tDZzbwRYyuZk3DyZHRGxR8QFijhRHzK0PSNj7UsqmnWroZGvlmYC7iy+B/HBOGe0186iriFVfzrLpKhYmcYJGx7NeLqUl0KrcBxnH9rxwRiYuawGXXD1H6bg0NfCQTYxgrfXRKe76bVJYeies9fWHerMaqEU+eM4ZISM3gLCY+AXEjcjnieKYQSWQwVnuP41t0TnRD+sM91mZHy49tH7JVOr0QdhX56vneh+H0RTMPriGYMha6MfgfLbjTAIHHTI6NgxUXMUweJs21kFGfUtlB9N2EMKYBmHCwDYreXtGVd0dRG+QGv1KbhYw4nd1QjOu+psrE1yBH3UzQMKcXpAxg3chvLYH0Yj29STI4pzPQlb0A+hxVQ UhUZQf7A y+yNuZCyMwR8GCHPUH6O+qzXQoGzzFT06gPmhNQQoHDO/dxVePnDKpWE48gxthm9IEcTt+kY4vAIYtW86fgNSOcnE9RMdgU17F7Uq328FVMoqfh2whyKxnonP0WOWXdGNxKdfhIvmE3GoUgDQGHJHV++pcW/5nyRgz+Mj36rwDWfnDVHYfXbAfcKr/KfhzaS0ZB7xiojrhqBA6Q9HgbOXfa9P0cQ7giSID20FUKtShKGJmHNAHcu6CC3Vf14suwr9VGaO2twf+R72gFh0Hq+YLqx/OLYJzoeGTa4+IAoI8CH3to9h2R/QInV40sZG5insILquclMfi7naiRIRRrUXkhs6CrIEXcGBQPE9yrxao2LmVHbHJyKebEmG+UxyElzXXix28d5RdTg7/7XIM1rsdEdgIWqbkThWVQpPc2yXne1s/YZqH9URH6AbYFMMmw4rHAub2lzm8ox6XaEXzTtw72kozOAlml/39b5X 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: Let's fixup the comment, documenting how free_one_page_maybe_split() comes into play. Signed-off-by: David Hildenbrand Acked-by: Vlastimil Babka --- mm/page_isolation.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/mm/page_isolation.c b/mm/page_isolation.c index c608e9d728655..63fddf283e681 100644 --- a/mm/page_isolation.c +++ b/mm/page_isolation.c @@ -298,11 +298,10 @@ __first_valid_page(unsigned long pfn, unsigned long nr_pages) * pagelbocks. * [ MAX_PAGE_ORDER ] * [ pageblock0 | pageblock1 ] - * When either pageblock is isolated, if it is a free page, the page is not - * split into separate migratetype lists, which is supposed to; if it is an - * in-use page and freed later, __free_one_page() does not split the free page - * either. The function handles this by splitting the free page or migrating - * the in-use page then splitting the free page. + * When either pageblock is isolated, if it is an in-use page and freed later, + * __free_one_page_maybe_split() will split the free page if required. If the + * page is already free, this function handles this by splitting the free page + * through move_freepages_block_isolate()->__free_one_page_maybe_split(). */ static int isolate_single_pageblock(unsigned long boundary_pfn, int flags, bool isolate_before, bool skip_isolation, int migratetype)