From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E8BFB5FDA7 for ; Tue, 7 Oct 2025 04:39:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759811974; cv=none; b=AvE0zsJECLRRK967JPPeCfteilRnWxeegaS+93CR4gN5TWiB09HE8Eul159cFNX+EG6rDRLYY/DgVZFIX2oybnR1yiJ3P+mkqRFV2PpR2gLmwJOz18tGWsMlx2Wasvsee3LZFSlEoB6X9vzGM7uMWWTNYocmD2eKKflpBbud3oE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759811974; c=relaxed/simple; bh=ZEjwKV7KCaCqaG6CV2M/Yiahp9JEm8AkBNAcW4fQQgo=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=RnAo8gYFV/w3hRP3vZ7Y3t7VKeABsN+A/Lv+wn9lza3dGNSg7219eFBm7G5lDt2hDF8k/w00JU6x2FE5U4iLsa7YvEhqqeWDPJBeXn+ve8wv4F4eITJf0SglGvomKzFMsSr5l8tSBRRcIwgPSKSyvBj5dS5TBsIa7lmwWmfedJI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 3B1FE14BF; Mon, 6 Oct 2025 21:39:24 -0700 (PDT) Received: from [10.163.65.24] (unknown [10.163.65.24]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id A8FF63F59E; Mon, 6 Oct 2025 21:39:26 -0700 (PDT) Message-ID: <0d1bcfdc-031f-4841-b0f3-15ae1d1ffb8e@arm.com> Date: Tue, 7 Oct 2025 10:09:22 +0530 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH mm-new v2 2/3] mm/khugepaged: use VM_WARN_ON_FOLIO instead of VM_BUG_ON_FOLIO for non-anon folios To: Lance Yang , akpm@linux-foundation.org, david@redhat.com, lorenzo.stoakes@oracle.com Cc: ziy@nvidia.com, baolin.wang@linux.alibaba.com, Liam.Howlett@oracle.com, npache@redhat.com, ryan.roberts@arm.com, baohua@kernel.org, ioworker0@gmail.com, richard.weiyang@gmail.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org References: <20251006144338.96519-1-lance.yang@linux.dev> <20251006144338.96519-3-lance.yang@linux.dev> Content-Language: en-US From: Dev Jain In-Reply-To: <20251006144338.96519-3-lance.yang@linux.dev> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 06/10/25 8:13 pm, Lance Yang wrote: > From: Lance Yang > > As Zi pointed out, we should avoid crashing the kernel for conditions > that can be handled gracefully. Encountering a non-anonymous folio in an > anonymous VMA is a bug, but a warning is sufficient. > > This patch changes the VM_BUG_ON_FOLIO(!folio_test_anon(folio)) to a > VM_WARN_ON_FOLIO() in both __collapse_huge_page_isolate() and > hpage_collapse_scan_pmd(), and then aborts the scan with SCAN_PAGE_ANON. > > Making more of the scanning logic common between hpage_collapse_scan_pmd() > and __collapse_huge_page_isolate(), as suggested by Dev. > > Suggested-by: Dev Jain > Suggested-by: Zi Yan > Signed-off-by: Lance Yang > --- > Reviewed-by: Dev Jain