From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7D7F82DF13F for ; Fri, 20 Mar 2026 03:13:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773976388; cv=none; b=f2u7e/CGM4vX2sqJaLjQn/Df1akhEXXJsYnPJ+6QXVdAHb7ddeBiylWD3zuf+5qM1VKmkghqkon36KsLP4VFdY1zylOeQlCblXb1fgI6PLeKTIZ7Q8wzyHuC5H85c81ACRcKVKDBSF5DoSAUmSWg33Ml21BqIcOmsAD2dL1Ugzw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773976388; c=relaxed/simple; bh=hSRlLdh6fNLbDWhBflQxUS6/kj7upsBYBNPCIVlnL0A=; h=Date:From:To:Cc:Subject:Message-Id:In-Reply-To:References: Mime-Version:Content-Type; b=c5ZXspIK9qQ4eisRCB+4i5fUvLc+BVjjdJkLpx3PaF3d5uEoWI4cflZJCD80EgvSi/sF4C57D082jG8XSYbIiKQDZmNeA4YUvukvEKlY9lQffNAKtGX91LHrm6wzrcbOtAFaT7a+8v8QjPU0DucBIlvKufXtb2rkh0JcRt16p2U= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b=kXIiy4cQ; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="kXIiy4cQ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9A385C19424; Fri, 20 Mar 2026 03:13:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1773976388; bh=hSRlLdh6fNLbDWhBflQxUS6/kj7upsBYBNPCIVlnL0A=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=kXIiy4cQtJZzc4lD9BdXL/n0a1g+am0DgjtGgvNg1lD6RST5L3W25MAPBSLwM9RNv POPNgzX+gPz3QofT8xly854/Yq/CkSODtg1s5b+GhDuvvXHc4p66fWvgwbzvlz7wME StKb3zZDbPhsHKYfMt/SEp+CKj7F3Zd5rQa5Thhc= Date: Thu, 19 Mar 2026 20:13:07 -0700 From: Andrew Morton To: Yuan Liu Cc: David Hildenbrand , Oscar Salvador , Mike Rapoport , Wei Yang , linux-mm@kvack.org, Yong Hu , Nanhai Zou , Tim Chen , Qiuxu Zhuo , Yu C Chen , Pan Deng , Tianyou Li , Chen Zhang , linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm/memory hotplug/unplug: Optimize zone contiguous check when changing pfn range Message-Id: <20260319201307.da2257e27949adace34460cf@linux-foundation.org> In-Reply-To: <20260319095622.1130380-1-yuan1.liu@intel.com> References: <20260319095622.1130380-1-yuan1.liu@intel.com> X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Thu, 19 Mar 2026 05:56:22 -0400 Yuan Liu wrote: > When invoke move_pfn_range_to_zone or remove_pfn_range_from_zone, it will > update the zone->contiguous by checking the new zone's pfn range from the > beginning to the end, regardless the previous state of the old zone. When > the zone's pfn range is large, the cost of traversing the pfn range to > update the zone->contiguous could be significant. > > Add a new zone's pages_with_memmap member, it is pages within the zone that > have an online memmap. It includes present pages and memory holes that have > a memmap. When spanned_pages == pages_with_online_memmap, pfn_to_page() can > be performed without further checks on any pfn within the zone span. AI review asks questions: https://sashiko.dev/#/patchset/20260319095622.1130380-1-yuan1.liu%40intel.com