From mboxrd@z Thu Jan 1 00:00:00 1970 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 7540AC27C4F for ; Sun, 30 Jun 2024 07:30:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 289C46B0082; Sun, 30 Jun 2024 03:30:13 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 239906B0083; Sun, 30 Jun 2024 03:30:13 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 100BF6B0085; Sun, 30 Jun 2024 03:30:13 -0400 (EDT) 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 E57F16B0082 for ; Sun, 30 Jun 2024 03:30:12 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 3AE78A3592 for ; Sun, 30 Jun 2024 07:30:12 +0000 (UTC) X-FDA: 82286731464.28.FAF6205 Received: from mail-ed1-f54.google.com (mail-ed1-f54.google.com [209.85.208.54]) by imf14.hostedemail.com (Postfix) with ESMTP id 1B85410000D for ; Sun, 30 Jun 2024 07:30:09 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=DjpjyCBT; spf=pass (imf14.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.208.54 as permitted sender) smtp.mailfrom=richard.weiyang@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=1719732594; h=from:from:sender:reply-to: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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=Romo2Rws3SXl6Hu/WGFHqujxXuHEUyq6mUzOlvEzG8A=; b=bNcP4u2YKOKS4+eZ/1+1kl6Sr2RC1w2hNA+DFwVZiZHldpI7uzSXDV4VRsCpMQEiQtjgsM 92RCuyDlna/wEId6MCmt6XpBaix1lE8ak7H5IbUL0JOnQNKVMefHAUXO4YtNMhV+XzvQOx g1x002HnZhhrFTgXHwTwTyTHm6x+Bms= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=DjpjyCBT; spf=pass (imf14.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.208.54 as permitted sender) smtp.mailfrom=richard.weiyang@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1719732594; a=rsa-sha256; cv=none; b=n9883GB/cJwB30kEwiTeXSFFxrzRMxCOFOMDKR1at/1xzj9vy4G8X/lzuq+T8XHOAj9YYc wKPHg2bKePt3Ghq7wSNwcxA+1WDjdu8NUyeZVxO/kjP3fBNPCoPY2iCARGNo4c5QyOdmTi lP3KiXbqcWQqcuOVT+SGz3kDX1vZdLI= Received: by mail-ed1-f54.google.com with SMTP id 4fb4d7f45d1cf-57d106e69a2so1844308a12.0 for ; Sun, 30 Jun 2024 00:30:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719732608; x=1720337408; darn=kvack.org; h=user-agent:in-reply-to:content-disposition:mime-version:references :reply-to:message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=Romo2Rws3SXl6Hu/WGFHqujxXuHEUyq6mUzOlvEzG8A=; b=DjpjyCBTiJ29AffNBkKJwsY6eypRVuj7yKJPJzvBxbHCuHAuHZ9aKLd3yqgpU3LLfw 85Oyn94VD9LQcb2BX7zkFRQufA/fXaQN7lrppjx2Hh/7bYMU5i5mVbbWcMenlfkiRrGC oiU5C4fZjDIFi2XXVwqv5cNHiBn5Nk4FlGCRPrrjUv8wiFLUaYFqBlEUVKaraMiUKydO oC95Rgc7JL1aZ43KfCdgTbQjcTewHtYk9nQN+a/Dkm3GXj/SDfQhV91BKD3JxYwNufon yPjn5QLq9+gyr/ktQw5iA+zWvaK8jJ9UJ5j4uBbOSy/CB6KNmyDaRaidW/9tO/4vgIuT wFdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719732608; x=1720337408; h=user-agent:in-reply-to:content-disposition:mime-version:references :reply-to:message-id:subject:cc:to:from:date:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=Romo2Rws3SXl6Hu/WGFHqujxXuHEUyq6mUzOlvEzG8A=; b=gWHyXieJjeQ8slNJ9NZ6WcQSfY1bxzpL5Ch/yKMmj6j9Wg1D/soXLOgpp+LCOZT8vk Mgi6CO2nJqb7c9bbxPqmlCA411rld3JzEaHJaFD2EH6A6OHbPHhI7726TpmbnylSbgFV n4AiX57D3XfA7g8ysORR8L/b1DKipLkOdAmYXJ8j9rz9pdMjYNH7cezqMIfooFgjvlXn cOxFy1qpdzH/DOq/qILDld9p3NBWucRkAp9yiG0wp64fqKgMRywthgHQUQ4e0S6BZAcb gC0vpgPpOW8bg7/Nx0xtnAa7yb6H4TTOFKEvkBAIQ2b7NSHnkt3NLve5uCWC+Hap1fVW ozKA== X-Forwarded-Encrypted: i=1; AJvYcCWuLJCQR6yMtrVTGPpQQxwS2Qo5g//0aetK0AeBrD5W/FOxHsWkwiFZib04ARhIj7Fwom+BO29ODlogIwk6tAzHvMg= X-Gm-Message-State: AOJu0Yzc4MiefDDpt9un2+0Kit5K7cCP1UanI3apyZJRPQOcrti/mBzd NcWj+AIhjmvECrD0WcEc1MHHcned0mnBqm0ik2IixxaTH4gvRG5H X-Google-Smtp-Source: AGHT+IE+mIZQ456HUgsNW3urAfDKmc0ojNEHo20jvyjYVOa31IwQfrMTjmHasdN0OO9hVgW9zTPCaw== X-Received: by 2002:aa7:d7c2:0:b0:57d:4396:6085 with SMTP id 4fb4d7f45d1cf-5865da42a99mr4060269a12.19.1719732608193; Sun, 30 Jun 2024 00:30:08 -0700 (PDT) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-58614d50593sm3045628a12.60.2024.06.30.00.30.07 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 30 Jun 2024 00:30:07 -0700 (PDT) Date: Sun, 30 Jun 2024 07:30:07 +0000 From: Wei Yang To: Matthew Wilcox Cc: Wei Yang , akpm@linux-foundation.org, rppt@kernel.org, linux-mm@kvack.org, David Hildenbrand Subject: Re: [PATCH 4/4] mm/page_alloc: no need to ClearPageReserved on giving page to buddy system Message-ID: <20240630073007.5iz2jubzd3ws3kn3@master> Reply-To: Wei Yang References: <20240629013322.12364-1-richard.weiyang@gmail.com> <20240629013322.12364-4-richard.weiyang@gmail.com> <20240629084411.pto6h3vsbxhq64ii@master> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20170113 (1.7.2) X-Stat-Signature: 6hwdskjneybqhpmtortnbyqh6xqo9z31 X-Rspam-User: X-Rspamd-Queue-Id: 1B85410000D X-Rspamd-Server: rspam02 X-HE-Tag: 1719732609-975637 X-HE-Meta: U2FsdGVkX1/5iJBcqBtJ2Vpb54J9fsw1eXW+gS7glfSc3Mz3bsV1cK5IA4kAN+4gMpq+ITmvW/e529/aAUqVUb95T2xBYDhzb37/gimPajw6Fede+eCH6pXI9DDH12H5zx3at9wQzV/OrJp9Cx/86iW5zUxhFV5ijNgdCL8BWk27mT4VAWNzYm7YCR86UDlEphcjIrZZqEbaRqQg4mfZnDCgq2c6gZRmpsrvuM0REbdHeOHBba91/Dk2Vs2mVILI6/SNUvFO++voP55uEupc6gaxmRwU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RxriyRvFGXh1YmxcXSkJdDL84yps4f8STntGWikpamNJL3F/T+GBWnJherBP5zSV6gapLg21wmOtIb5xMLr+6eNaKngNeAWvc9kIVFaYc/5/jw0H1UwALA4Y/6KwDt7VzAAkUZGqL9h58bF3hQK1TQlUZRm/bo3N/7V/JRLUKu6Icxa//PI+R4RvVnvWFHjPmCvXednO2bXb/j7S9PVsUaNqKHoke2fjdO6jlx4taZpVqDz6Lvx0v8a00hFF3yqShnjOCVJ3GnOgz12WIh5vWoxN9oRzTKroZhvcYBczQBPrUj/CRsZnfxA7eHKf8Y+DDYKyUfZwOcpp/KT3nm8V7ghsqyYrS+Rx9j+vkfttTTQ2z54ldLsK9bPaOiyh0C5ovjPdcAhxGvcQP5WrXvghWhPdPAM+RYhThFiId+q1i 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: On Sat, Jun 29, 2024 at 05:45:53PM +0100, Matthew Wilcox wrote: >On Sat, Jun 29, 2024 at 05:28:34PM +0100, Matthew Wilcox wrote: >> On Sat, Jun 29, 2024 at 08:44:11AM +0000, Wei Yang wrote: >> > Per my understanding, prefetchw() is trying to load data to cache before we >> > really accessing it. By doing so, we won't hit a cache miss when we really >> > need it. >> >> Yes, but the CPU can also do this by itself without needing an explicit >> hint from software. It can notice that we have a loop that's accessing >> successive cachelines for write. This is approximately the easiest >> prefetcher to design. This is my first intuition on reading the code, while I *believed* there is a reason for the prefetchw() to be put here. > >I tracked down prefetchw() being added: > >commit 3b901ea58a56 >Author: Josh Aas >Date: Mon Aug 23 21:26:54 2004 -0700 > > [PATCH] improve speed of freeing bootmem > > Attached is a patch that greatly improves the speed of freeing boot memory. > On ia64 machines with 2GB or more memory (I didn't test with less, but I > can't imagine there being a problem), the speed improvement is about 75% > for the function free_all_bootmem_core. This translates to savings on the > order of 1 minute / TB of memory during boot time. That number comes from > testing on a machine with 512GB, and extrapolating based on profiling of an > unpatched 4TB machine. For 4 and 8 TB machines, the time spent in this > function is about 1 minutes/TB, which is painful especially given that > there is no indication of what is going on put to the console (this issue > to possibly be addressed later). > > The basic idea is to free higher order pages instead of going through every > single one. Also, some unnecessary atomic operations are done away with > and replaced with non-atomic equivalents, and prefetching is done where it > helps the most. For a more in-depth discusion of this patch, please see > the linux-ia64 archives (topic is "free bootmem feedback patch"). > >(quoting the entire commit message because it's buried in linux-fullhistory, >being a pre-git patch). For the thread he's referring to, see >https://lore.kernel.org/linux-ia64/40F46962.4090604@sgi.com/ > Thanks for digging the ancient history. And now I know the linux-fullhistory tree :-) >Itanium CPUs of this era had no prefetchers. Oops, so sad to hear it. So it looks the most helpful change is: * free higher order pages * non-atomic equivalent A quick test on my 6G qemu virtual machine shows the prefetchw() here seems not helpful. After removal, the meminit process even a little bit faster. From 135ms to 121ms as the sum of 3 times bootup test. If you think it is ok, I would wrap up one patch on current mm-stable for more audience to review. -- Wei Yang Help you, Help me