Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp8949315rwr; Thu, 11 May 2023 08:09:03 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6dFP5KeMJ9at1GkzujgkLFYBQeXM3oj66E8lnIy/HLb4UKgkca/a6aFp8ACP91/5tCe55k X-Received: by 2002:a5d:9cd3:0:b0:76c:69a0:664e with SMTP id w19-20020a5d9cd3000000b0076c69a0664emr4411578iow.13.1683817743439; Thu, 11 May 2023 08:09:03 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1683817743; cv=pass; d=google.com; s=arc-20160816; b=XqIQMpE/6RpbAoUAhK8nPlbYBVUFF20pkVatkBU+gfBxLJpMc5XITq//HzGwXSYzem 1RXzdSp/uPsa/DWS8MwJpA+lOhFGqvPeLhBRHSfj/5C0QZfYLVgunvLOM5nBr0vX4x3F uzoyJwcTiwwTj31fTlG/hFNDqu9sbJ2CKJRmKBNzVOPIcyd455hQt58BSpGaMm0c9U9r sIX81fDa7ZMJ/JnuUdCRV1uYj5DswwIXeHowyQReLtE+PZgrMErrBhetWXCl9hBgCxhq cqz5iBUEowaAsKRMA2nDdMWmbk2mmr3NGruYIc38W1awoe2TMNdLNl24rD030AXDPR5j R8GQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=fPAvK6KtczdZAoCfECMAL4Fncht5KsST0n5gG2X0bL4=; b=Do0+RgTsNDYxvDVP6+hxdzA4Yav0X+YXyleU42jhyEqz/PqGHbRpMaVxhMjdsL7tHz F9YZ/sUt60kTlFxiIGFwEQOn3i1Y87d5lP+cbB5/RCusbct0Vn+XuNlYdkcwZw5TIc6o 9O3x8pE5VvRigxUWtMRRb3DxjkPV3N2ZeWiyGL36QtH8FzllCSYBJtnUTaWCUcjgLm9Z xVjCamSVCgf41FYerOj4RQBz5vZZEweCS5dEzTNybiCczg7ChFnR5Vf0uJQ3L03BcWst 65X1ASzi0WDyeR1caGCF2a4IePhxXm8BVrQi8efMmhT6JcBx7fujOIEvjoq2GzQdarWm /esQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=FiEULSed; arc=pass (i=1 spf=pass spfdomain=nvidia.com dkim=pass dkdomain=nvidia.com dmarc=pass fromdomain=nvidia.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=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x11-20020a056638160b00b0040fb1a42b66si5657939jas.194.2023.05.11.08.08.48; Thu, 11 May 2023 08:09:03 -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=@Nvidia.com header.s=selector2 header.b=FiEULSed; arc=pass (i=1 spf=pass spfdomain=nvidia.com dkim=pass dkdomain=nvidia.com dmarc=pass fromdomain=nvidia.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=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238588AbjEKPBl (ORCPT + 99 others); Thu, 11 May 2023 11:01:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57994 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238522AbjEKPB3 (ORCPT ); Thu, 11 May 2023 11:01:29 -0400 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2056.outbound.protection.outlook.com [40.107.237.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 43BC7106C5 for ; Thu, 11 May 2023 08:01:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WXYoYvuk9FxH532j+bcTBcbsMkNeTLAJ3cIEHSn3LeVsUDEHIzRa1cz8iRhG6YOTCisByszzqLtG2watIA+uXgq5CFkDaXoa+egHR758DnvWw5esogYp+wkpuKcmpsVCZKMKcTsjiiLtDZbsdA9uFUPqsRdJXVZxuACUJHOpX2T5ae03ypAF8Anvg5k1xdzwF1kUiSX+z+WoKUb0UEqkmJanoBHZ3G0lKVkz+xa+M+847Ylpb9yCIx+RN6qZ+gJA8x1SaUoJBmyR8rwqtWYidIE/lfDYj16ecu8B0spww+E8JhqI3ZexladPp1M4QmD+q+8J0XAA9VQL6VXp2o+Khg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=fPAvK6KtczdZAoCfECMAL4Fncht5KsST0n5gG2X0bL4=; b=XV93DbzxeFQx7X1KVkSG2GPSMecHz2v7+LJOSpjOqjLWatNvono/Em+O8Un+nAGC/We2BjEAhg3NIGDbFT3O5AM6qExDSj5yJZof3qmYkB2TRdndBEBR2bcSunb+1V/vjIAzKMqa1wuG02UeGJyg0hhlpW31x9CBdIRcq7WDIUw3Apmv4IYDhGGpDVfck0UDQyfhTDAfdp5auIlnwxrajf+sV3aGIw24J5YYS4lSkb6sZUb/+MRJAzmUGbM3yO48WZFnHr6G7IQ6aolqPK/NArBv3Fk0IKIOs3UB8Wyri5k2ZR72NbO9HKSdkpR0B1ZCTbmAMRBIrONnXkQUxt813g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=fPAvK6KtczdZAoCfECMAL4Fncht5KsST0n5gG2X0bL4=; b=FiEULSedqTXTy5go0zTdrvHy8ooN/xvIa/hHJ41rTfLIG1pJBtgL4TtNuMeAo2NkbzsWRlcX0D3RBcHkMw1sSiv09zJoaEqC9oH4wTt8eHdfZNGeU2mDzECc2rn0DqaX4JyhmYYnn3DN35YHDT9AZpIPehcV8UBSNs273Lnccg+p08GMKQjVHYMfbOzx6TBguBLbxoVZ0Yn60mwYMKNxLmTFRTZzbQJhLUkK/Odms7mjA5wIAo4Hi5r35QGDDbJCgTYqAV80LL8yafTZfyinpQ4oavpF6uvlm/nfRcwfU5d9SLrqgQDtnEAF5FBY7dPPwjqi4NqFwZDvQUgiN2iMnw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from DS7PR12MB5744.namprd12.prod.outlook.com (2603:10b6:8:73::18) by SA1PR12MB5638.namprd12.prod.outlook.com (2603:10b6:806:229::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6387.20; Thu, 11 May 2023 15:01:14 +0000 Received: from DS7PR12MB5744.namprd12.prod.outlook.com ([fe80::847b:988d:86fe:a0f8]) by DS7PR12MB5744.namprd12.prod.outlook.com ([fe80::847b:988d:86fe:a0f8%5]) with mapi id 15.20.6387.018; Thu, 11 May 2023 15:01:14 +0000 From: Zi Yan To: Ryan Roberts Cc: Andrew Morton , "Matthew Wilcox (Oracle)" , "Kirill A. Shutemov" , SeongJae Park , linux-kernel@vger.kernel.org, linux-mm@kvack.org, damon@lists.linux.dev Subject: Re: [RESEND PATCH v1 2/5] mm: damon must atomically clear young on ptes and pmds Date: Thu, 11 May 2023 11:01:12 -0400 X-Mailer: MailMate (1.14r5964) Message-ID: <9F292AC7-6632-437B-9F9F-DB3CC10240E7@nvidia.com> In-Reply-To: <20230511132113.80196-3-ryan.roberts@arm.com> References: <20230511132113.80196-1-ryan.roberts@arm.com> <20230511132113.80196-3-ryan.roberts@arm.com> Content-Type: multipart/signed; boundary="=_MailMate_0C62BA84-9682-4BD7-82EA-B7380486FE1B_="; micalg=pgp-sha512; protocol="application/pgp-signature" X-ClientProxiedBy: MN2PR15CA0005.namprd15.prod.outlook.com (2603:10b6:208:1b4::18) To DS7PR12MB5744.namprd12.prod.outlook.com (2603:10b6:8:73::18) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS7PR12MB5744:EE_|SA1PR12MB5638:EE_ X-MS-Office365-Filtering-Correlation-Id: 892acc35-c606-486a-3f50-08db523090c9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: sR92dKGxHgqpl0U68n5EzHjzMrZE/gOnWsjRdDK1XOmiaaRKnEfga+DSsi9zki0UDyij+qBgEQgA62hJZUMcBrEgrT4w5UPtCBfp5A34kwzjiYgzqT+SlnJQUhsBEvMpbEGHHl6dvVLEcj/xHpmG47PJqwDPA+2am2qmPpE8PW19yjboBN/wklR1MPT8AivI/7elHVUSQnuh4YK1gGd9K+UWkyF75EaUAsygj5y14nWMFWHnkFTCCI0OOR8BkmaerbHWavMdisoTrJnz+p8TtZmFqpQZnyEicmw6a9O6c32f3WgVA2YPP6h8LVWFM1rWJeyoQJpCCYDpPWGlFInxvJElXG0jDseJ8YACyTy1MN3J9/4Bp0t/dzC05BinemchjJQwkeIzPj1OduQ34lXF/MHrR5kdCyyatDYRsyXmgYEXWbQVy3NHcqfv3I82b3yRFc6eh0HYNwqh6ZiyOmk0oakitD/eY4838iBD5vLEUpMnTCgKwgPLHvebe80FFM1N1/Rb9N8OJUfKPwAjgmrBakFF30HLTIORXaNJNzVc0e5GeIDtieJgFJ5ov42YVNRHQlL5CvN6lR3xQ85Z6AyjwCObNlCbIyguRcyQ7Pq0d2jl2o1lknoD7DuhCroumsyOTVtWQbd8VonTagSiHANjKg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS7PR12MB5744.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(376002)(136003)(396003)(366004)(39860400002)(346002)(451199021)(186003)(53546011)(6512007)(6506007)(478600001)(83380400001)(26005)(2616005)(33656002)(6486002)(8936002)(86362001)(316002)(5660300002)(41300700001)(38100700002)(8676002)(66946007)(6916009)(66476007)(66556008)(36756003)(4326008)(235185007)(2906002)(54906003)(72826004)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?lqQPUDTyH7xFqcNBDrEpTQXx2HlbXU8EYts1o3kc6IGJSUfprxUhEDdTZOXG?= =?us-ascii?Q?e4cPjXmKMjZx2lHJFCJPAJycLVEOrr6I+6TWWrreI0uWG2he2Clt/QMyRYgw?= =?us-ascii?Q?oAi01NBzAQTGCsBpBoMzi0g/x8pRIRPOul2FB1pH9JBrsyu3VDKPBDJFe01g?= =?us-ascii?Q?YjQbxKKVQAHO05xZ4RBq1LnRG0QY6HW/61eHw6VDI1Kc98ijkPhxBO63Ymx7?= =?us-ascii?Q?4rynxCXK5aJx+C5eDvbCxcCiWMr2nWaFIPafzlOEFwKqbAuktt76hHpsha7X?= =?us-ascii?Q?Z9KIEs38LPjGiE8P+7v+OaRkpOvlIJCXx9TnG4EjBZBnmqQnOtGJRg7CUIBb?= =?us-ascii?Q?pqAQn4/SBye0JZ7m+lDWxC7m+dOjO9/m6DBlM6Mncor7/72Y8P/U+eiVhlds?= =?us-ascii?Q?9Pg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h4n?= =?us-ascii?Q?fS3iNEYq0aWTRGNyD1e4YsB7eEIPLyC1k+Ds+Zw/flai9fUV8LTdBiHIC49N?= =?us-ascii?Q?cTBqGx2AnEL7qHqV/TtfXXTm190ev8YclhEIJBom40cWT38HExrPWgKVyBRg?= =?us-ascii?Q?N4nCjSfyHotKEqEczDNqARkKa+2oxkX5jGKpYwKgkfJZF4FaTRSCd/Je5naL?= =?us-ascii?Q?oq/cpCE4/ZUUPCS7h9fsJmpfuGo6pu9PvrkzN06UkB8wF9cz8n5Tsv2OFJtz?= =?us-ascii?Q?rz9ddkT7xKZMhLN5t3RwgJcCzPdz4URKumCi+VCf?= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 892acc35-c606-486a-3f50-08db523090c9 X-MS-Exchange-CrossTenant-AuthSource: DS7PR12MB5744.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 May 2023 15:01:14.5909 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: h1LtO9xqHcpRVHfyALCumUYlTNCpTvGUzb3RnTfa3Gx1p5zuGmZ02VsrRq57jLg4 X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB5638 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=no 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 --=_MailMate_0C62BA84-9682-4BD7-82EA-B7380486FE1B_= Content-Type: text/plain On 11 May 2023, at 9:21, Ryan Roberts wrote: > It is racy to non-atomically read a pte, then clear the young bit, then > write it back as this could discard dirty information. Further, it is > bad practice to directly set a pte entry within a table. Instead > clearing young must go through the arch-provided helper, > ptep_test_and_clear_young() to ensure it is modified atomically and to > give the arch code visibility and allow it to validate (and potentially > modify) the operation. > > Fixes: 46c3a0accdc4 ("mm/damon/vaddr: separate commonly usable functions") > Signed-off-by: Ryan Roberts > --- > mm/damon/ops-common.c | 16 ++++++---------- > mm/damon/ops-common.h | 4 ++-- > mm/damon/paddr.c | 4 ++-- > mm/damon/vaddr.c | 4 ++-- > 4 files changed, 12 insertions(+), 16 deletions(-) > LGTM. Reviewed-by: Zi Yan -- Best Regards, Yan, Zi --=_MailMate_0C62BA84-9682-4BD7-82EA-B7380486FE1B_= Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQJDBAEBCgAtFiEE6rR4j8RuQ2XmaZol4n+egRQHKFQFAmRdAzgPHHppeUBudmlk aWEuY29tAAoJEOJ/noEUByhUSekP/RdADZFCE+icd5hp0JxNHvFd4IKrb+ZYzsZ6 gYzmAAnoU0XFtTh1nZNvmbVZE7ITtGH9IgnLXgrZfJv6NC8WF5lT9xc5F0IQww06 8EqWPOpgHg+bBZ7bqprWjYxbFI6XYAdif9Zpb5WPrTjvecXhsgGXpC9ipbuetBAJ F6vvb0/TkWSTSPd7VHr8dHNQnVpD4lP1wfDOCHOjTceE9COhNIiMYPDoq5YnblNq V3JDw5u4gDjikYXdlVmGJV0kWNpezGCWsfCqf1NMR72EtWAANYzBGdZuaqJhiI8S QqWHPDQUfUhEMArsWvhZawc45oTDNF9MnZLtP/DJhJEp9h0H+vALz/fTG1S2Jbxr 1VYUYYO9COCJi1UnlDyymwMSoj9WkfnYXJLxRxKaXE5R6YSiPRh9RAp7NtycJtME lL4MEAkiFkTTjKiBY7tt6XbXyHwZOCbw5y0ZxbUIlZvCW7r1pZuhqYNQwPI1vR+O VfZ+y5sDFxv2bf2rEdp5Oe3ksy4brelhRba5xPFu0L/VnyGPupYvBG4c6Z1RhLF9 t5vH84kgOUlx+MNMMXzYJA82vDW5Rgw3yhByJ0S5cUFoDzDa8hCBOjPdTNF/OCcJ SBW5U5NYS3sYzFAbngMq/UaETZ762RQ92ao6fJ3VkRPL3s+kbaKSrYs+hMSw3hK2 L7dgGfNX =JJyb -----END PGP SIGNATURE----- --=_MailMate_0C62BA84-9682-4BD7-82EA-B7380486FE1B_=--