Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp1044700rwa; Sat, 20 Aug 2022 22:58:01 -0700 (PDT) X-Google-Smtp-Source: AA6agR5tZlsufPj/PJ7Yd2PIdQMQ5DVxj7SrutO9S6oYEBio9B7nDwtblTdE/F7RHJVVKE+cWvNU X-Received: by 2002:a17:902:b410:b0:172:c9d1:7501 with SMTP id x16-20020a170902b41000b00172c9d17501mr8010754plr.106.1661061481438; Sat, 20 Aug 2022 22:58:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661061481; cv=none; d=google.com; s=arc-20160816; b=ypRul1BokIdWkLOE8V3EhUJuQ+/a++z51YI5GcfNljXguPSfwrjOlON3xP1AhBA37q OA/FZBxaTulMHvrxRSCmkGC23oZPjL8ynUtGXBz7C/VzZKDNcm1LOCyLr/9YQtXrDsS4 LTUAnIJR+V6NwktJ9MLTUM15vr9jygutMOZd5moKKxtOB+igOjblVL+qEfm8xhcW1MyP F6z3xCWDLjsJNf34PdjX+MJ6k/jNAoCC6xUszvAHcYrO3iDSrBr+gK28THaN9Xp2E/gu Ba4y6/m9i55S9l1k2TdQQc9DalzJLXNV33+xTaXPV8MPxHJp5GfgjJx5ZqTtmMuFtZVF 65RA== 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=GYacSkgGfC7AASPWKd7s5/dQOn/4FtL8w3szIzRiRhc=; b=DZQjtFH+MKJX2pFIwGacsNoub52RsxKBJTfoVOY1aSGM6miv+KPq6aF2Gwd2Rb1J3h jZ5eRxBMQAubMdtYLPJQxtWMhC4iwu5cMo3vlJeYMIyV1eTWn7ODp29vc3S5naDqtD7c LMlkcELr67E+1Ef5UQbH4aR2oceK1ysxs6i7SBmxbWOu6TdAdUKKQjlGhS7amSBHOKuj 2Zix1fOzJsRR1Lhk6z2yfYu/HAvHjamzn3MqiuCBeS+F1flERugyYdLY+dGWJhO3rOHq js9ngeVoFnFotloArGOianONLLCF/UN80st+SEcKe1cFajqYQVWAwTl72g3j1S2t4Pnn nMhw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=ONSCKv91; 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 r136-20020a632b8e000000b0042a00292790si7553141pgr.242.2022.08.20.22.57.50; Sat, 20 Aug 2022 22:58:01 -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=ONSCKv91; 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 S229713AbiHUFqZ (ORCPT + 99 others); Sun, 21 Aug 2022 01:46:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49074 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229456AbiHUFqX (ORCPT ); Sun, 21 Aug 2022 01:46:23 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E14161E3E9 for ; Sat, 20 Aug 2022 22:46:22 -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 ams.source.kernel.org (Postfix) with ESMTPS id 81B6DB80B87 for ; Sun, 21 Aug 2022 05:46:21 +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 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 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.