From patchwork Sat Jun 29 01:33:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yang X-Patchwork-Id: 13716753 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 96377C3064D for ; Sat, 29 Jun 2024 01:33:52 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2C1F86B0098; Fri, 28 Jun 2024 21:33:50 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 248DA6B0099; Fri, 28 Jun 2024 21:33:50 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0C4136B009A; Fri, 28 Jun 2024 21:33:50 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id DB86E6B0098 for ; Fri, 28 Jun 2024 21:33:49 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 5C5EC409F2 for ; Sat, 29 Jun 2024 01:33:49 +0000 (UTC) X-FDA: 82282204578.06.2954D4E Received: from mail-lf1-f52.google.com (mail-lf1-f52.google.com [209.85.167.52]) by imf24.hostedemail.com (Postfix) with ESMTP id A080C180008 for ; Sat, 29 Jun 2024 01:33:47 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=E3iNYYro; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf24.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.167.52 as permitted sender) smtp.mailfrom=richard.weiyang@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1719624812; a=rsa-sha256; cv=none; b=4HgFN1942Ro0fS3LOm/unM5tCiPvOXpwTklGzYqWERqCrp/y5Nrp1lKU73kzAxXQ+2i7zq VdfOrYtPojGHriCQgyMQgbdzvWjDy+djFC5Ouji6AqjiMzxMJlmCSfj7TH71mZcysEa/yC WwzeYsmo7QGlaYyELCuR0VZXruY153I= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=E3iNYYro; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf24.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.167.52 as permitted sender) smtp.mailfrom=richard.weiyang@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1719624812; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:in-reply-to: references:references:dkim-signature; bh=9J4Xd+IWU6L3qeE3ESnngjp/FE7dVNp2iZSoEAyz7Io=; b=ksLTUy1QiB9ro1nUWw80DVh2biR7+EBbswxEtyIfUFjv0C83d6xpi+4SLn/5jiUlyOnojB SZSLs36+mmsKz3ZiJtIhrxsIs3fk/z103UQ1opTRwxroyaucEh0GdPcT3HPU483hEy0tqL aRTn3L9i3JAoWL2M+xVl7TmT+BG7je4= Received: by mail-lf1-f52.google.com with SMTP id 2adb3069b0e04-52e7d2278d8so1762814e87.3 for ; Fri, 28 Jun 2024 18:33:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719624826; x=1720229626; darn=kvack.org; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=9J4Xd+IWU6L3qeE3ESnngjp/FE7dVNp2iZSoEAyz7Io=; b=E3iNYYro2VCtkqdNrKQpDWDtLEMth+mxlDInHNgLPOxr0MhONdT4ZWE6aD4CgqGetR KQkdrvSDC/TRmq3mkqIBbddQOKfOMveAaDIzQOdnwOBur98NGbEFsSgwgU+MfWViUJOl uNG6f+iOoIeZ7fUrYJzOm8m0QgLJMC3Jn+ciXUt1L71iOiaqxs1TB5M5X0evb2kB48i9 vmQcXgKd3EjMUgORzx1O+35nGT50hjDpDIqvyDK8QejXB891YYO0z44HheYAJwdscVZT XQ8CHZAZQwAyOUKFKXlNvo2wmvyagRrbiRvDPh6o9qf0LUoRRdw/Pdbuyy4OWsbv3CpT RBNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719624826; x=1720229626; h=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=9J4Xd+IWU6L3qeE3ESnngjp/FE7dVNp2iZSoEAyz7Io=; b=WfsHGiViGI29uMLR6FnoED/KyLxjIXTTujnG+L38n/dQOGRD9L25okPPRAY6u/Usi9 qtCX9iWyKpY1f15140uzlFMVrmsEmsy+dkSd+/oUSztue/pUmaQ9cdyP0vTKo3pw39cB 2cTyo/PtCdui2a+f1bGJVoyWGphZD86m9wmrz2omvxINbRJZTcRhsCrMNZel03DuMs1k knXL7iRHAoo1dbUFewRDYyzc5eQKz5mybmJ9G/+9b1MTi4jCk36MUG/yfHTwGlrF0YxP QiEu0J/nHNbDiZW7pwRd4/BcPWCxZRKGE6epYHLcwrGCVifV5XesKx6jIH9HLCVajhVL U+hA== X-Gm-Message-State: AOJu0Yzi5t+njnq63SdhvpkuKU1xPk2R86KJ8uwlwcxGi6hoU/KkyYO/ eGzzGCO+pTadkJC/SUtJW2IXSm5Ys0l/Ys0jj/GrsiNgPS4bslREM3SdSi1b X-Google-Smtp-Source: AGHT+IGRIwbnSRhAQcJpJrzMc79H4+m0nEm8m0cyneHe+EmQcF8FznHNEN4e+NHsfTn0GPTXnI5EDQ== X-Received: by 2002:ac2:5392:0:b0:52e:76f6:aa5b with SMTP id 2adb3069b0e04-52e76f6ab43mr3050140e87.17.1719624825974; Fri, 28 Jun 2024 18:33:45 -0700 (PDT) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a7430367d55sm27255966b.87.2024.06.28.18.33.44 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 28 Jun 2024 18:33:44 -0700 (PDT) From: Wei Yang To: akpm@linux-foundation.org, rppt@kernel.org Cc: linux-mm@kvack.org, Wei Yang , David Hildenbrand Subject: [PATCH 4/4] mm/page_alloc: no need to ClearPageReserved on giving page to buddy system Date: Sat, 29 Jun 2024 01:33:22 +0000 Message-Id: <20240629013322.12364-4-richard.weiyang@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20240629013322.12364-1-richard.weiyang@gmail.com> References: <20240629013322.12364-1-richard.weiyang@gmail.com> X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: A080C180008 X-Stat-Signature: 8xafzett6hsbtahpsyxesqqdmjqzdpb3 X-Rspam-User: X-HE-Tag: 1719624827-316178 X-HE-Meta: U2FsdGVkX19gk5426x+LIwVG4gQMaLzL4JH2YRgrEQZxj/LsOqz/FTW1Fxu8b2H7Z7JcSKYKCHg8DGQqWgbhBPTUScqvGTIteB+U3AbOaTl3Mh2yih34zoL/TjMZwZoNyeJPBe0Ar2GXWMigyXMT1lWOOb0zm3K75YfNkdPruFI0TkZxhiqRkXuylc1GQYniF4v7rhyVk4ayN6BSgdUep+oHW3IXSoTxxeEqmctbOYVt3PtsV9N9DPETYea84wm/LJW0RPYKQ5cb17KbBpOMuXhoQRgNLAECFdTi7SOgDjRBkxmlaJb2hqa0GDOmBcXAUHnB7SuL6crIKf5dvU0d9BEwVtkEJv9MCbDc6zcj5KqQIvlJvR5Dr8W954x7nvEtkU8iJwt3Q3OUWzDbYk5CX5v3YRQ8ZyNW8mHm9QVax2dqbyA4LIX/QjElpA0P58U4t3OKhUTFEHbPxcy9SEzmhHaod4GEccUlxFfa7Gd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b0uWl 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: Function __free_pages_core() is only used in the following two cases to put page to buddy system: * free bootmem * free hot-add memory After the above cleanup, there is no case to free page with PG_reserved set. Let's remove the clear operation. The page initialization time shows 6.5% faster with a 6G qemu virtual machine. Signed-off-by: Wei Yang CC: David Hildenbrand CC: Mike Rapoport (IBM) --- mm/page_alloc.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 51a47db375b6..bc7316744a34 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -1232,10 +1232,8 @@ void __meminit __free_pages_core(struct page *page, unsigned int order) prefetchw(p); for (loop = 0; loop < (nr_pages - 1); loop++, p++) { prefetchw(p + 1); - __ClearPageReserved(p); set_page_count(p, 0); } - __ClearPageReserved(p); set_page_count(p, 0); atomic_long_add(nr_pages, &page_zone(page)->managed_pages);