From patchwork Fri Dec 6 09:59:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 13896800 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 43F61E77173 for ; Fri, 6 Dec 2024 10:00:01 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9D7D58D0001; Fri, 6 Dec 2024 05:00:00 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 985446B0204; Fri, 6 Dec 2024 05:00:00 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 84CB08D0001; Fri, 6 Dec 2024 05:00:00 -0500 (EST) 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 6085C6B0203 for ; Fri, 6 Dec 2024 05:00:00 -0500 (EST) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 0A92E1A1946 for ; Fri, 6 Dec 2024 10:00:00 +0000 (UTC) X-FDA: 82864087488.07.5E5B248 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf21.hostedemail.com (Postfix) with ESMTP id F412D1C0007 for ; Fri, 6 Dec 2024 09:59:25 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=grW1Hm8b; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf21.hostedemail.com: domain of dhildenb@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=dhildenb@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1733479182; a=rsa-sha256; cv=none; b=s9sU6mR3i7aRGEVL2GBjirXILJ3nGPqlfWBPy5nVmCCKlxXfnOWtbe3g9mW+ugzzcsGui5 CH30Cc6LhqSet1qEzNBgKO5nVOMhBSKifAxwjecq+6+O8Gf5yYwx4MU0j7DBsntziirpak rrvjzQq++dALEC0RMKvaNM+KE41TPOE= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=grW1Hm8b; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf21.hostedemail.com: domain of dhildenb@redhat.com designates 170.10.129.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=1733479182; 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: references:dkim-signature; bh=LTMkpEFSseFO32cP/f+vLN1CBb0AvUaOTImxXTbbB78=; b=x4LPiFuzH2c/3kIOCHxs6oFPPB8A4IDv9CoXzny7TvWPhp/vJNIIfX2Rt36wlNJi+ncnZL jnBe9F58pe5dnQniGYDBEUP8HojlJajKrg4E/wWvbcVPUbE93Nu0qS6qq9J1vRRvLN2KRm GycsAlzYHEpQ3cuqnF3r0yK/vg7sGcc= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1733479197; 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; bh=LTMkpEFSseFO32cP/f+vLN1CBb0AvUaOTImxXTbbB78=; b=grW1Hm8b4BaI7avVsPdMra8u4xRIf6rp9G+mQSGIWo1jNzrhKYLEVfkXV5XHXJtf1Jw1KO VCg+BvPl/Xd9Qo/KxdloQftyys4sWaHT/VP+exEd3F1kV+W7Hsv4XwoCjcg6SazTa9OBo5 7kpGa0eLH5bdsWyvraKrH04kfn594Bs= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-117-1E6WK6sqOkyncgjMuL4z8A-1; Fri, 06 Dec 2024 04:59:56 -0500 X-MC-Unique: 1E6WK6sqOkyncgjMuL4z8A-1 X-Mimecast-MFC-AGG-ID: 1E6WK6sqOkyncgjMuL4z8A Received: by mail-wr1-f71.google.com with SMTP id ffacd0b85a97d-385dcae001fso774460f8f.1 for ; Fri, 06 Dec 2024 01:59:55 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733479195; x=1734083995; 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=LTMkpEFSseFO32cP/f+vLN1CBb0AvUaOTImxXTbbB78=; b=PnyFmqUle6OQw+OgOaev5tNTrWI75+NWgqkDoerPAZiRyuD+ejlK9RcZMgCKCUUf8D 7DvQnn6+daRmGV9Rf6QnjqKaGRtGHanB3U2GBqjy5bndIodVUcVkMrrMATnuvy20ZSm9 LqDZv9BEs2JJqwATp9QVR5XiejHCSK3AbGGu74bKCo+E4sv+SLF0hRZxSgx5Z9HAtH9U s94XfLzLiRfdv75VYvTe9IAndutkk71MM5eMgv/KxgBv+bvmQZR2SNk1N1dUSp3y0f1I KoDKKqhWqBaADWhlMRbl/BUC5UuNOhFdjET9K88/Oyaiz52nc/7+6rE3NCvz5sQGp+v7 bVsg== X-Gm-Message-State: AOJu0YzrDAQNwu9HfLsWeabO7qYXavgSpCt0esTA6zc2TfUllDEinPeR SxpPYlGmnQzQOHcye3vPQhenV913zY+y7ncs/Z5K3JvvOkTjA3OSfoeh2HwFFB0aEG+L3oFLhAC hh6gvwFmd3Sv3vNawH9Bew75nQmAFF/aBaynk9hHjkUU8jc4z X-Gm-Gg: ASbGncvCenTvlkUdl6KioL3GAw6ZsSEIzkxm2khnDNRNB8nvpFTaT5WvvLVleWbJhXh oEFY/zHi9hbGKRD2jGISpvV9s63AgOfvzyHRk5dzSmVDUUQkmLigIq0MZ6FN2xNjWPcGunyV9D9 AJXpJk/Q084bvOTWAoF4zjxy98NqvHGiVYDsEWZ8nji13MAC8ePxZ7xaBc8OR+VsQ3wbriDNdDD 9od8QW9O7N2do33XAS7Qrnxko1XIE32cMICKn3bSvqUHaWwrAhIP/7pvEx6OVezij6fBTxEiN3J rY0hu6Vz0QuTyhhHGs+YsgBSb0kLF/dwaQg= X-Received: by 2002:a5d:6c69:0:b0:385:e013:39ec with SMTP id ffacd0b85a97d-3862b33f0d1mr1630909f8f.8.1733479194925; Fri, 06 Dec 2024 01:59:54 -0800 (PST) X-Google-Smtp-Source: AGHT+IGkNmgJD9hn/EQiOmOvCb8sPlPYIIl6Kex5KTN3jtxwAtKApW8MzqmIerHVsbe30yftdPAcYA== X-Received: by 2002:a5d:6c69:0:b0:385:e013:39ec with SMTP id ffacd0b85a97d-3862b33f0d1mr1630887f8f.8.1733479194617; Fri, 06 Dec 2024 01:59:54 -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-386220b01c5sm4138557f8f.94.2024.12.06.01.59.52 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 06 Dec 2024 01:59:53 -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 0/2] mm/page_alloc: rework conditional splitting >= pageblock_order pages when freeing Date: Fri, 6 Dec 2024 10:59:49 +0100 Message-ID: <20241206095951.98007-1-david@redhat.com> X-Mailer: git-send-email 2.47.1 MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: D3Xjx7dAKqbcGrYNSg0Kp4LO5fmr3UoHq06p0T-Aceo_1733479195 X-Mimecast-Originator: redhat.com content-type: text/plain; charset="US-ASCII"; x-default=true X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: F412D1C0007 X-Stat-Signature: wyctndh6t5kxuau7ubehbpjgoruhchq5 X-Rspam-User: X-HE-Tag: 1733479165-78809 X-HE-Meta: U2FsdGVkX1/sB0QQnyaCYVLGG/PuCIWL7bSxK2aIh33i2AnWE05w+aqZtdVe0adq9CT/IDSY1IyXMeK2Riru3nWgqueKtswbfL104/g6dPAMBuGx1nNalzz6ayJSk2Q7bVNEmnrSA2kTBnxShE//DK0Pi7eWENa6+tymnjmazrAmEIOsjt3r4uZl7jtVMTM1yqswB7LV/0R9UAp2Mv/QghfGQMkO97kbEG9FYCUFFkvZ7XrNy33szTUq1E242vsguQThdR87SgJmPCPBzTgFe26N7mD8qNMG6kmZYYFB603HQE/PuJM6bcx5f58qiQB4vwx3pcSTrsDhT3C2rPdUjitAAjpMXIVQ7bXxkooIRtyFMUwVohRplrFj1YKa9vI+1Rs1+caElzqPiZotpESS3LJokuhyTaI6WlP4wyj1g0YF2OFfhGmSVjyY7yAe3zxEPjDlFB9/spH4sQhRx7WrmcLcDhhv3oHccxMzfay7NA3eRLO8DiZMg3/3RHbRnwuIY8pTqYAHA7joAQVjjNr4KKNzR1w15t7y/ZFo8XUzefxZlakgNLLL6lYqBw+cLA0IGQ4M1WytRJ5xmc7pcjbYbCXeIW3h/ChZog2XrOtV+SGsTTOMDh4wVjaY7h+qlFNVeddm2o5uYJJ0dugYrU7fknqyZhnSPcdlM4kKZTdfitI+yIdR3ayZ+9Bu4ylNC3Ug9kFC1an3eVeokPAt4icCPP5KdX4wKrimd0xrFg9XJk0xEHNnIINTLRqVIESE1zXZIwe7GHFpkPu1Tp0XMUqmmm48oIGB+i2+2TaY7EBhFhDRWKfKtquI9tVj5h1OyYMhPPF/08M8WsVFLeVdZetHNX4nGYjyWJ98ZC8O3N7N3aan9OZlkleHOE3fs5eHQspfjLuWZUFhm8VEbLLEkmoepiXmUDiNCfVyzHxunEySLpMJ4ftrNXDWOUtIxm/flOQg0wlqg1KMYxXXmDvpR+5 NizFN3oi +vvs7it+ec/izCP64vPnUIdfrbE0MPjOqVimlCFUOD4TqTxvWt1CGaUvoMOOeg5iYmvG7J4a9VlrLG4zsGuZAkUaGCvVRgMRqftlU6ItjLOekTE8cIgdh4AOdnHnMQdKenz1uj066H4Sh2WQDWRlzUkL5Is3+dh9wTLFig9f5L3JeSV1fCIYkADESHL0FYbyhnBFGpQwLABAS3hZSu8PLNcjRZf9O5y3oa+Zx/vdEO8Cnb6GLt/zLtf49T23bgwJPqN3oF2vqgqXGoDwulfx8oYPzWmcnghtOZeZqd0Yc6IvaLpyCX4K1BJgfL2q1bgNCawxT8FT+b7d0Lb+cOHc5ETswIK8vHipiWxylWX/t6nmglhdXAyqg6+FnYrtCwMrnNEGD8zTE8LQOrbQZ8tQP9xxeecs9D/FIIOZdb94zTNWqT+UCAlOO2xGhfabiS8ZuL2qaeVv7yZX9ciiJuStdVzL9RVX4L1TmrgQAirdP12spSrPtu6SdcltoyKEsrekiNVxlpBAZ0vUankojLWVCHuQ2XvUc/GeU89dm2bj8KROgpqxAcgY4bOtmwQ== 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: Looking into recent alloc_contig_range(__GFP_COMP) support, I realized that we now unconditionally split up high-order pages on the page freeing path to free in pageblock granularity, just to immediately let the buddy merge them again in the common case. Let's optimize for the common case (all pageblock migratetypes match), and enable it only in configs where this is strictly required. Further, add some comments that explain why this special casing is required at all. Alongside, a fix for a stale comment in page isolation code. Tested with runtime allocation of gigantic pages and virtio-mem. Cc: Andrew Morton Cc: Zi Yan Cc: Vlastimil Babka Cc: Yu Zhao David Hildenbrand (2): mm/page_alloc: conditionally split > pageblock_order pages in free_one_page() and move_freepages_block_isolate() mm/page_isolation: fixup isolate_single_pageblock() comment regarding splitting free pages mm/page_alloc.c | 71 ++++++++++++++++++++++++++++++++++++--------- mm/page_isolation.c | 9 +++--- 2 files changed, 61 insertions(+), 19 deletions(-)