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 CD2FEC25B08 for ; Sat, 20 Aug 2022 21:17:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0ABDB6B0073; Sat, 20 Aug 2022 17:17:07 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 05BD66B0074; Sat, 20 Aug 2022 17:17:07 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E652E8D0001; Sat, 20 Aug 2022 17:17:06 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id D3D196B0073 for ; Sat, 20 Aug 2022 17:17:06 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 9656CC05C3 for ; Sat, 20 Aug 2022 21:17:06 +0000 (UTC) X-FDA: 79821231252.18.AE0B8D4 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf02.hostedemail.com (Postfix) with ESMTP id 1F8AD8002D for ; Sat, 20 Aug 2022 21:17:06 +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 ams.source.kernel.org (Postfix) with ESMTPS id 6211EB80AE8; Sat, 20 Aug 2022 21:17:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E11E7C433B5; Sat, 20 Aug 2022 21:17:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1661030223; bh=Sb8q+wdl7LvC3K03D3hmnGvtwPPUklgx1RNisq/uZBw=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=vaIY3p3qbtc5FEF/gv8e80FXAjxQrY4cgEWfZ8kn3457psduk9CsYcwGhWAh3tPPy t9r/Fh4+WG8kUNlye8P1KwmGGPyB+73hScPPXDXl8gke/9XTV+4fO4pZUeSYemhbPk H7ijKQ6ETGuT+VTsm7xzuxVZevSo8ZeNuzeJTiJw= Date: Sat, 20 Aug 2022 14:17:02 -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: <20220820141702.e731f2aade5da8cbe0c78cba@linux-foundation.org> In-Reply-To: <58b1d1f5fbda7db49ca886d9ef6783e3dcbbbc98.1660805030.git.baolin.wang@linux.alibaba.com> References: <58b1d1f5fbda7db49ca886d9ef6783e3dcbbbc98.1660805030.git.baolin.wang@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=1661030226; a=rsa-sha256; cv=none; b=DCKUjW+NyQ+RyJ3cr2kr82R3Avn5992TteVz4rJsJtZmA8Bfu9EPwJVk/1IziA3UOkcCYl Lvicr4YqkDUyrRIFrD2iYwY829ammqCKDdeKh+8gmIqQLjpGAjLZJ2AeqgDFNbohgsEEp2 jXXDArZ5F3H3HHGHR/kdF2PjdkFbFf0= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=vaIY3p3q; spf=pass (imf02.hostedemail.com: domain of akpm@linux-foundation.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1661030226; 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=w0EMXwA/UFkgfnko0URIbgYVZrUQqHoYr9JYgxGnX+c=; b=a3pGyZrm11747s+qVqjPV49lqbDBpGtclr/m8M+Eio2VsAyqrVRpbzfaPVBMXc7bWjZbmR aBTnZDa5FTGzZDRlfat6hZRS/7u9m0aaXAl0uPXf+73dN3b8BuHO5ujetX3CJ88q2DiY+P K7eCGOjBX9H8FpyXmzBpWacv+z/JSM8= X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 1F8AD8002D X-Rspam-User: Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=vaIY3p3q; spf=pass (imf02.hostedemail.com: domain of akpm@linux-foundation.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org; dmarc=none X-Stat-Signature: jw9h9i5sj3hprtdb5g4f6gy5jcf5ezwi X-HE-Tag: 1661030226-287219 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 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? What are the user-visible runtime effects of the bug? "make the access statistics incorrect" is rather vague. Do we feel that a cc:stable is warranted?