Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp174438rwb; Thu, 18 Aug 2022 01:32:14 -0700 (PDT) X-Google-Smtp-Source: AA6agR5riLL5lJh7ZhaSbF3pB2pEFLdZkGGXESoFh4k/rOAoxBEbrsLluevw+iyZ0KRjd1pwec1w X-Received: by 2002:a17:907:843:b0:73a:5b0e:8352 with SMTP id ww3-20020a170907084300b0073a5b0e8352mr1229304ejb.438.1660811534429; Thu, 18 Aug 2022 01:32:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660811534; cv=none; d=google.com; s=arc-20160816; b=tc90nQXtl1dG5+MrLLvelUS+5WwMoaRHxTEMa/InJo37QereTyhXlOi4d+2SRefU8Q 10JsYPyo6cA/J4QIvQh7wAR7KaV5Mj5ah4d9kCcw8G6XBbt9xVVek0xdpxXXBT/aioV/ u8eXkGQ+k4Y3I0nz3lC667wquqrYponYLyicuv52VjHDAyxvLGpQAphy57oxSvQ15tXn RqfJVPEfffz4NYTRz33GZY6XxB5iaFYGe/dPY1qhZL0Z5CMVTHc1EhUorpKiGCW7cQ/F fKj2HEhmAPlVaMbZu588NiYSiA8/IsovSvomk7EI9tNJc52byTUho9K/Lwncbg0NtI/F IgiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version:dkim-signature; bh=GmDACFAww771N8QDTZCRoxaYGKF8g2ZcH88LHpMyuOQ=; b=PK8qvghW98PJrIHgdfcuGeA5fU24QhkHAHmAA8Vbl1SZcVXPBcaad1UKxDJsTPHUMh NbURTpBUAJWUS067yQ1psyJX5n62hD1oZoDeQwK2mzGi6z/5kVpaQn7BpQCdBN0G2U8t ulnXwElxLcZOezI+/Wmh2ddphpmgJiajHc8VNGZCsEBK3ZJ8jF/1w9KBblpwQUVm/4xI B8HR/s3hcQJBtI6dpWClp/iEUqQoo+/L98fZABK8lsxFM6Q+54QI7NxmkmStSOUiekJy TyULXC9ThRsp0ooQMJo/jKWC81Nru/XxbmtPLCQJdPiDhUP7zOW1RspfsoGePkBBTwZ2 BVaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=i4uEb4xT; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x31-20020a50baa2000000b00445d9cee755si825887ede.287.2022.08.18.01.31.47; Thu, 18 Aug 2022 01:32:14 -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.dev header.s=key1 header.b=i4uEb4xT; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239604AbiHRI2W (ORCPT + 99 others); Thu, 18 Aug 2022 04:28:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35022 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238978AbiHRI2U (ORCPT ); Thu, 18 Aug 2022 04:28:20 -0400 Received: from out0.migadu.com (out0.migadu.com [IPv6:2001:41d0:2:267::]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 77DFE9584 for ; Thu, 18 Aug 2022 01:28:17 -0700 (PDT) Content-Type: text/plain; charset=us-ascii DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1660811295; h=from:from: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; bh=GmDACFAww771N8QDTZCRoxaYGKF8g2ZcH88LHpMyuOQ=; b=i4uEb4xT2CK5L/Y7PRLMc1NDACaYTmcgl7O+fTwj0efVvaC5BIkWasWWIr2OB3DVx3xZ3y y3Ifi+LMJIloPqAoSVDM1Fva9sR5PCHap83JuCcv7BKLjYajA4bbvKrUurUoLIz/2yKSPM s45TYx25iDkJwsGxBbITbsfZUI977HY= MIME-Version: 1.0 Subject: Re: [PATCH v2 1/2] mm/damon: validate if the pmd entry is present before accessing X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Muchun Song In-Reply-To: <58b1d1f5fbda7db49ca886d9ef6783e3dcbbbc98.1660805030.git.baolin.wang@linux.alibaba.com> Date: Thu, 18 Aug 2022 16:27:41 +0800 Cc: sj@kernel.org, Andrew Morton , Mike Kravetz , damon@lists.linux.dev, linux-mm@kvack.org, linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Message-Id: References: <58b1d1f5fbda7db49ca886d9ef6783e3dcbbbc98.1660805030.git.baolin.wang@linux.alibaba.com> To: Baolin Wang X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: linux.dev X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 Aug 18, 2022, at 15:37, Baolin Wang = wrote: >=20 > 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. >=20 > 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. >=20 > Thus adding a pmd entry present validation to fix above issues. >=20 > Signed-off-by: Baolin Wang > Reviewed-by: SeongJae Park Reviewed-by: Muchun Song Thanks.