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 7C8D8C00140 for ; Sun, 21 Aug 2022 05:46:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DC66E8D0002; Sun, 21 Aug 2022 01:46:22 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D4F2C8D0001; Sun, 21 Aug 2022 01:46:22 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BEF788D0002; Sun, 21 Aug 2022 01:46:22 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id A8AD38D0001 for ; Sun, 21 Aug 2022 01:46:22 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 7D1831404BB for ; Sun, 21 Aug 2022 05:46:22 +0000 (UTC) X-FDA: 79822514604.15.8DC6F32 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf23.hostedemail.com (Postfix) with ESMTP id 0FFB2140021 for ; Sun, 21 Aug 2022 05:46:21 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id BFAF060CEC; Sun, 21 Aug 2022 05:46:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E4D44C433D6; Sun, 21 Aug 2022 05:46:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1661060780; bh=wx25nGmnocMRdHKc23V1POqa4xFoHN4F4EfKi0wxXss=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=ONSCKv91EAhsxA8cQYxDVQVB/GKl7Jzigww1nH8hntTFk6F8Y1dFKwRxMn3jGnP6g QfvZI5aT/ru3Q3V4Uhn8MBWkWaw4S2zu/I0TwF3NXv9beritDmgfmUbaB3NjPYrRQm Uev+0OCJ+8PLP3DXm4elvD1Fqg+0X4WVDSuiZ0tA= Date: Sat, 20 Aug 2022 22:46:19 -0700 From: Andrew Morton To: Baolin Wang Cc: sj@kernel.org, muchun.song@linux.dev, mike.kravetz@oracle.com, damon@lists.linux.dev, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 1/2] mm/damon: validate if the pmd entry is present before accessing Message-Id: <20220820224619.002b9ec30ca7167d7d37f473@linux-foundation.org> In-Reply-To: <162b6039-bfb9-7dac-e72e-be946ea0621f@linux.alibaba.com> References: <58b1d1f5fbda7db49ca886d9ef6783e3dcbbbc98.1660805030.git.baolin.wang@linux.alibaba.com> <20220820141702.e731f2aade5da8cbe0c78cba@linux-foundation.org> <162b6039-bfb9-7dac-e72e-be946ea0621f@linux.alibaba.com> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1661060782; a=rsa-sha256; cv=none; b=O8rs9TPa4UNcK+jvl4ZXc3GEVnum6tTwsZxC8JmtkeBnCgK1WUJfjkfKWp2/PoJN+puir7 avClDK4yY/ikHsR7Z/dop4rp6s+HPtKW/jjBOuGHtfovK1ak4qwwviHSqiM23SkVmc08XF c9u8p1DSyTWO/JKoEMq4aIMUr4sjFRg= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=ONSCKv91; dmarc=none; spf=pass (imf23.hostedemail.com: domain of akpm@linux-foundation.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1661060782; h=from:from:sender: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:dkim-signature; bh=GYacSkgGfC7AASPWKd7s5/dQOn/4FtL8w3szIzRiRhc=; b=uopLTGXVIEYEesNBcvXnjjO50h7R+mZHtw6YAYuaH/m3fZRn/hEaKSGLdmQTFYs/KuqTRy yBI97nk6A14L809xauYNuI4Sr4Ws/LnOypFUkcCbzj9nqlShPZwO2efGdT46pu5U0DxCN3 UGvMIHwcH9vm9k+msYJ4yX4s+Q3Z23w= X-Stat-Signature: tpm9whnjzfh4y1hup9644dq898w7yyuz X-Rspamd-Queue-Id: 0FFB2140021 Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=ONSCKv91; dmarc=none; spf=pass (imf23.hostedemail.com: domain of akpm@linux-foundation.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org X-Rspamd-Server: rspam03 X-Rspam-User: X-HE-Tag: 1661060781-768815 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: On Sun, 21 Aug 2022 13:22:42 +0800 Baolin Wang wrote: > > > On 8/21/2022 5:17 AM, Andrew Morton wrote: > > On Thu, 18 Aug 2022 15:37:43 +0800 Baolin Wang wrote: > > > >> The pmd_huge() is used to validate if the pmd entry is mapped by a huge > >> page, also including the case of non-present (migration or hwpoisoned) > >> pmd entry on arm64 or x86 architectures. That means the pmd_pfn() can > >> not get the correct pfn number for the non-present pmd entry, which > >> will cause damon_get_page() to get an incorrect page struct (also > >> may be NULL by pfn_to_online_page()) to make the access statistics > >> incorrect. > >> > >> Moreover it does not make sense that we still waste time to get the > >> page of the non-present entry, just treat it as not-accessed and skip it, > >> that keeps consistent with non-present pte level entry. > >> > >> Thus adding a pmd entry present validation to fix above issues. > >> > > > > Do we have a Fixes: for this? > > OK, should be: > Fixes: 3f49584b262c ("mm/damon: implement primitives for the virtual > memory address spaces") > > > What are the user-visible runtime effects of the bug? "make the access > > statistics incorrect" is rather vague. > > "access statistics incorrect" means that the DAMON may make incorrect > decision according to the incorrect statistics, for example, DAMON may > can not reclaim cold page in time due to this cold page was regarded as > accessed mistakenly if DAMOS_PAGEOUT operation is specified. > > > Do we feel that a cc:stable is warranted? > > Though this is not a regular case, I think this patch is suitable to be > backported to cover this unusual case. So please help to add a stable > tag when you apply this patch, or please let me know if you want a new > version with adding Fixes and stable tags. Thanks. Thanks, I took care of all that.