Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp1035207rwa; Sat, 20 Aug 2022 22:38:18 -0700 (PDT) X-Google-Smtp-Source: AA6agR7KTwH9mz+jlRfRoGubCwtL2+/wYuWPG0qZbQ22UF6qYv0LA7Eus4grsZcJD/pFyHo+8b+I X-Received: by 2002:a17:90b:1d8b:b0:1fb:179a:4647 with SMTP id pf11-20020a17090b1d8b00b001fb179a4647mr2283483pjb.162.1661060297999; Sat, 20 Aug 2022 22:38:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661060297; cv=none; d=google.com; s=arc-20160816; b=TcN6p0I5dNXMyZWQTtwNM0ZBkc9tiLH0apM7+AYGR2QsIUxRKpczXJmv/VUmYYbLg9 bya2p3a6ejqsMwoVeuOALoWpG2cu0nT83NqlGglvGR0U7rMUbQpwnlRr/F/YQBbMbhtK UTVLJZm9J8dcipkCswsAPZNgd9bsmTzhEXDhqU184PhsY+oDoqsv3YytE761SBrh5rGN 75bx8HVNkOjIh6twcZzXl0YDU9gCzHv3Ro6P8rQRb7pqBzC6R2iddPgAhEewNvE5RZ8O DGruuGspde3O9gD2lp5sT3ngolIJvsPY489cDm9/QellutVWjx6LzW9rMt7FYu4VkPrL TUKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:subject:user-agent:mime-version:date:message-id; bh=Jz/iNK76U9inIvbGBHF+MNhFdUhAdMmOe20o0RTcck8=; b=KBCJQ5Tt0rdV8uX9/P9GYGfDIr17eJJ7Je9pmGmHkOfrV1k2F7N+J9/qjiw4v+vzuM ib3oykrGOUphFlbhhVi1nvgvsQmZgAXmfAvOxSG6QJjXvXxBI395CLwL+AXwebBXhJ54 SLLe2vkZ+rF9tzJXY0eZMiIsw26kU9Vg3H841tUKwbCcq7JMgOu2ITX6v88dvbEkR/Z2 hd4NAcoeo8GSp01oYMrDerZH1NkWELCdu6A/hgK9RuQrDi/AkGJq/wb9eHmcowpdguJu ElcZmeN8jl49rMAga4gpHtBe2GHVKHboOL9r8DqAcmBvPfFGX6Iw9ZgJRGmOEr7sAoDv 68wA== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j24-20020a63cf18000000b0041b7be8ef1csi5603690pgg.219.2022.08.20.22.38.07; Sat, 20 Aug 2022 22:38:17 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229813AbiHUFWi (ORCPT + 99 others); Sun, 21 Aug 2022 01:22:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58004 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229379AbiHUFWg (ORCPT ); Sun, 21 Aug 2022 01:22:36 -0400 Received: from out30-56.freemail.mail.aliyun.com (out30-56.freemail.mail.aliyun.com [115.124.30.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 25BF727CFF for ; Sat, 20 Aug 2022 22:22:34 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R371e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046050;MF=baolin.wang@linux.alibaba.com;NM=1;PH=DS;RN=7;SR=0;TI=SMTPD_---0VMmQyAN_1661059349; Received: from 30.15.206.157(mailfrom:baolin.wang@linux.alibaba.com fp:SMTPD_---0VMmQyAN_1661059349) by smtp.aliyun-inc.com; Sun, 21 Aug 2022 13:22:30 +0800 Message-ID: <162b6039-bfb9-7dac-e72e-be946ea0621f@linux.alibaba.com> Date: Sun, 21 Aug 2022 13:22:42 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.12.0 Subject: Re: [PATCH v2 1/2] mm/damon: validate if the pmd entry is present before accessing To: Andrew Morton 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 References: <58b1d1f5fbda7db49ca886d9ef6783e3dcbbbc98.1660805030.git.baolin.wang@linux.alibaba.com> <20220820141702.e731f2aade5da8cbe0c78cba@linux-foundation.org> From: Baolin Wang In-Reply-To: <20220820141702.e731f2aade5da8cbe0c78cba@linux-foundation.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH,NICE_REPLY_A,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, UNPARSEABLE_RELAY,USER_IN_DEF_SPF_WL 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 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.