From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 ED4F414A8B for ; Tue, 2 Jun 2026 17:11:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780420309; cv=none; b=Q8q3KTkwepYh38tDuCU9VHrZFNAGxLnawAx72l1EO8sJZnsFNaoiHVWVACTyzEJvcyuWP5l2mJr/RFIC89TamVwMqnlXGWGVFdSDJMw7ETTG7y8FizEjiwjFTfTDsrjoSzR04yE0sEFnVdO4DauHmoBoNnyiUK9AUHLGFCf+eYg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780420309; c=relaxed/simple; bh=iN8gkdWJz8cWOimE/0q7gUuoNBRYIX2Fn/tMdwdkohQ=; h=Date:From:To:Cc:Subject:Message-Id:In-Reply-To:References: Mime-Version:Content-Type; b=H64WUIeZZAflqzPVRXdl8A9u75MAtMoqp79uQysfR+HTgz3c+THcZhrLjBZWDeg/CH//8lH50yixwDwNEaJoP9FSbDpzOULXvV3FUsHyViqicGRNR17fqvjloL1/jsZD3zzayQwpDG2qXb2ANV2ZPh7W3OORWh/ChLuQmmycZBw= 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=Ak3zR7eS; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="Ak3zR7eS" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 249931F00893; Tue, 2 Jun 2026 17:11:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=korg; t=1780420308; bh=pcaxoqI0f7sOWzEqQgUXEtGFp48y+8Mb3okU4L2UxDA=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=Ak3zR7eSQ8XRn7FpSS1z0ceFI0BXPJvJNIfih/4tmhYRS84tWUH2ZDPkuhm5N3UX1 TicFJKCCSbYQWUlNxf+NWzu+8pIc8SVWD0H1yU8ArROQ8cBdrEP2s9lh92mptyO4GB pLQ9J2DrF+KVNomVfNNciJoxnCyOPPROiZKhp5HQ= Date: Tue, 2 Jun 2026 10:11:47 -0700 From: Andrew Morton To: Zi Yan Cc: Kaitao Cheng , Vlastimil Babka , Suren Baghdasaryan , Michal Hocko , Brendan Jackman , Johannes Weiner , Liu Shixin , David Hildenbrand , Oscar Salvador , muchun.song@linux.dev, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Kaitao Cheng Subject: Re: [PATCH v2] mm: page_isolation: avoid unsafe folio reads while scanning compound pages Message-Id: <20260602101147.2892436f68fd383723c39855@linux-foundation.org> In-Reply-To: <34F0943E-4ACD-4655-B9B8-41F658FCDB7E@nvidia.com> References: <20260602130755.38794-1-kaitao.cheng@linux.dev> <34F0943E-4ACD-4655-B9B8-41F658FCDB7E@nvidia.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 Tue, 02 Jun 2026 11:02:41 -0400 Zi Yan wrote: > > - *step = folio_nr_pages(folio) - folio_page_idx(folio, page); > > + nr_pages = 1UL << order; > > + pfn = page_to_pfn(page); > > + *step = (pfn | (nr_pages - 1)) + 1 - pfn; > > return false; > > } > > LGTM. Thanks. > > Just a comment, order can be dropped and use > nr_pages = compound_nr(&folio->page) instead: > 1. order > MAX_FOLIO_ORDER -> nr_pages > MAX_FOLIO_NR_PAGES > 2. PAGE_SIZE << order -> PAGE_SIZE * nr_pages. > But it is not worth a new version. > > Reviewed-by: Zi Yan Thanks, I queued this. What are we to make of Sashiko's question? https://sashiko.dev/#/patchset/20260602130755.38794-1-kaitao.cheng@linux.dev