From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-180.mta1.migadu.com (out-180.mta1.migadu.com [95.215.58.180]) (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 96224366554 for ; Tue, 24 Feb 2026 08:46:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.180 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771922776; cv=none; b=oPGYc8sM7sdWrWB31aTwQJqZeI2vGelsBBSYva/Z/MwDq2r6PJUh3oQy0HXP7biEaUmgJivYAJ3/bUj3HK8BBh5TeQ1eO8rzkC+0JlBDoWntfv/QIiLz9YoWDiz3nmX0uwDNbgsBoEsyoSiCKhaLN9WUXWK/xqev9Nst7ov/Nbw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771922776; c=relaxed/simple; bh=S1nwuvblRbsITNzZhVcFTcbrxbgc+HEaELruf1Ki3ho=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=QNOGsED1r5CZFUN9AaAlzittDT1NtB2OZxrMEJxY/7abw5I1TbCc4XJzxAOfJETHBdDKZ3SjxEK2cButFiF44Vhyl6bJ9JQ6VpQDmf9UnrTt6fdZILO+LlWLFa8tDBWwCehZk93iFfJgI8Q3pYg5Bs3NarmmETFR55HdnCVzfWM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=t1zC1XfD; arc=none smtp.client-ip=95.215.58.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="t1zC1XfD" Message-ID: <108e41e4-cbfb-458d-b72a-1becca61327d@linux.dev> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1771922772; 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: in-reply-to:in-reply-to:references:references; bh=0uJ5WZpkoz2PlS+e/oWj8d2/Z4RKR5KjB8D2HwBT1fg=; b=t1zC1XfDHs3l9Q9JLpteHHfp9nCw9LADY1Q8lpmx29IDaZSudYzOpnNIiBSFgxI2EJ8Qwd S+Z5BbbMlxcvho7b56/rsvu3mcbvd/Jb12rbxrNkKGF/HT9REF8IoNOyUbuIMYwwbkEBYC qsYxYZJwWkWvBLRFYa8r5gJ3i+dUzCw= Date: Tue, 24 Feb 2026 16:45:59 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [PATCH] khugepaged: convert redundant check to WARN_ON Content-Language: en-US To: Baolin Wang , Dev Jain Cc: ziy@nvidia.com, Liam.Howlett@oracle.com, npache@redhat.com, ryan.roberts@arm.com, baohua@kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, akpm@linux-foundation.org, david@kernel.org, lorenzo.stoakes@oracle.com References: <20260219054827.4111334-1-dev.jain@arm.com> X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Lance Yang In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT On 2026/2/24 16:21, Baolin Wang wrote: > > > On 2/19/26 1:48 PM, Dev Jain wrote: >> Claim: folio_order(folio) == HPAGE_PMD_ORDER => folio->index == start. >> >> Proof: Both loops in hpage_collapse_scan_file and collapse_file, which >> iterate on the xarray, have the invariant that >> start <= folio->index < start + HPAGE_PMD_NR ... (i) >> A folio is always naturally aligned in the pagecache, therefore >> folio_order == HPAGE_PMD_ORDER => IS_ALIGNED(folio->index, >> HPAGE_PMD_NR) == true ... (ii) >> thp_vma_allowable_order -> thp_vma_suitable_order requires that the >> virtual >> offsets in the VMA are aligned to the order, >> => IS_ALIGNED(start, HPAGE_PMD_NR) == true ... (iii) >> >> Combining (i), (ii) and (iii), the claim is proven. >> >> Therefore, convert this to a VM_WARN_ON. >> >> Signed-off-by: Dev Jain >> --- > > Make sense to me. Personally, I’d like to keep this VM_WARN_ON() to > catch unexpected behavior. +1 Reviewed-by: Lance Yang