Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp793508rwa; Sat, 20 Aug 2022 15:00:36 -0700 (PDT) X-Google-Smtp-Source: AA6agR7w6hrw6OSX1c2ueo3UixruB3mAYnoEOtCpH46mEyGC/KN7JAh1/oKFLEpbiodDBoTb8Z58 X-Received: by 2002:a17:907:3dab:b0:73d:5383:b214 with SMTP id he43-20020a1709073dab00b0073d5383b214mr5049701ejc.449.1661032836564; Sat, 20 Aug 2022 15:00:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661032836; cv=none; d=google.com; s=arc-20160816; b=nBlxRNOp0l+36xtJuSf0NGAIhtYbWi1gUAvSGAvke1/dMTXvJQlfzHLbV3hQ1E5m2X sCUNKfte3Ru365LgRTX2ib/3TXoTN3yg7AT+VfxbQz35igk2hJvkXIExLxa1t2XkNgts +xc73l9G9uA+iBT1wC1jfGjRLeEzc4deVy6X6RgtTgNO4b0MHvFdon8euCEwdYVL4hoE pRni+K6Pm91qrbqjTmrtPLmraGUQen85XMmKYscBslJ8HDU65EF4Ih0RIpOhyp+qtz3q cJku9ZWtlEE6TM+4l94bqEBtaYuRDpaFI99xzdFbF599ao5ylSu9WKV/MWqpfcqc+K1H z7Uw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=w0EMXwA/UFkgfnko0URIbgYVZrUQqHoYr9JYgxGnX+c=; b=GeZRr44ngPRt/1R5JlesuFbDduH9OBR74Nq4TiZQFJmMmvOug3BRvrtqLQQB8LlKrw Fxn1nxyexlwNSKvgNgqGi/bG7yUeTMfQiVvtF0YcrVYnHWbLsSFnbYDlvfv9RCMrb3gz DnDgaoaED1Su1A0l0BY1iu9ObM4KZUte0+kqPSs5ZuuewD0MTITne4D9kYOz0wIkoItP XbZjrDj4Dr0P+NL1fceY7j+mE4geGbCUfT7whpLftuWpgtqtjxN5VHUHshru5Jm9ycJB Kr8oRqbvPKbFRyowr30XWqqSP6/XVZjvz3RzY81jzyksakaMHNrIuuHdZCCw0y0o216t MZMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=vaIY3p3q; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hs21-20020a1709073e9500b00730412fe4d5si6632845ejc.740.2022.08.20.14.59.43; Sat, 20 Aug 2022 15:00:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=vaIY3p3q; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231502AbiHTVRG (ORCPT + 99 others); Sat, 20 Aug 2022 17:17:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39000 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229472AbiHTVRE (ORCPT ); Sat, 20 Aug 2022 17:17:04 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 30FE63340C for ; Sat, 20 Aug 2022 14:17:04 -0700 (PDT) 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 C09BC60C0D for ; Sat, 20 Aug 2022 21:17:03 +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 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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?