Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2172062rwd; Fri, 19 May 2023 01:55:28 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ52ov1vjHuSnA2Raf8D83PDoBh2oxSzLWwv6QFYmov5MRo33+x4BcSf++z6ucrbV0fofyYG X-Received: by 2002:a05:6a00:2405:b0:640:f313:efba with SMTP id z5-20020a056a00240500b00640f313efbamr1910691pfh.19.1684486528324; Fri, 19 May 2023 01:55:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684486528; cv=none; d=google.com; s=arc-20160816; b=SO5XHO1T3S1Yw0xp9KR7neD32QsCb3k5zhHPAxQC4SNbdNSY3RPYVnpsPtLVc5/zV5 31ZQYjX5VneQSSYjiXK2juv04+ycHdbFsY2CeJBwFjlpXmAtDY3r+iDfXmmb9eF0ub9V 9uUK40w4tn1vnQ1T/CXIKmLFf3hTyrr3eSsWyRc5uAiW/kOXlgUqzoZLDnA8pRzJvETf 0bXBcQjiF/rrb9headXgUaV5tgqbvXCJk0ByvZGmCZw7QXau2WDqEHsBQn58PPi1sExG +ijmgPpxuOCQXa4NlYqPzsRCITPR4pc+04mLfp1Gu1n8UXlsfgYpnHaURXIVHpLB0NMh NzcA== 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=hyQLw11g+hGftGG4iCAG5rF7Yf0PyDNAVMXlYyl3FX4=; b=mozI8fZkb/Wy2mnmd08thyFyxYEMuwxwYP6l1lZkSpD31YUiGjKCobE+htXJcMo8I1 fJe3U/zguiXP/cfvKnhsQQ8ji2dzv4xPeF/lWPaB437ofqz7C/GuOMsqcU3AXbQCEk6m pn/AuCfB3YJpzwCC2bKgEAiWk5420EZb09fsPf4cIV1Yc3IBidTh5fpFuv3U7XoZjWlt 91tV6MeJJmNyKC5KyhKNtFu3LbVqD22VArZeADpeql+fH56UmcKiK3f6YHybxoDXPbWB lwEHRAzNGZei6mfmy1MNXXzVIpttaW5BckdNv3Qivqi7lXA35ahnIr+oH0VjPF2++wUY I1NA== 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=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s63-20020a632c42000000b0051909d663d8si3488507pgs.656.2023.05.19.01.55.13; Fri, 19 May 2023 01:55:28 -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=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231144AbjESIyD (ORCPT + 99 others); Fri, 19 May 2023 04:54:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43098 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230418AbjESIyB (ORCPT ); Fri, 19 May 2023 04:54:01 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 874DC10C3 for ; Fri, 19 May 2023 01:53:46 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 0451D1FB; Fri, 19 May 2023 01:54:31 -0700 (PDT) Received: from [10.57.73.191] (unknown [10.57.73.191]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id EBC533F73F; Fri, 19 May 2023 01:53:43 -0700 (PDT) Message-ID: <2ee0f754-6959-4fa8-0020-06f2d7fc76e4@arm.com> Date: Fri, 19 May 2023 09:53:42 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Subject: Re: [PATCH v2 2/5] mm: damon must atomically clear young on ptes and pmds To: SeongJae Park Cc: Andrew Morton , Christoph Hellwig , "Matthew Wilcox (Oracle)" , "Kirill A. Shutemov" , Lorenzo Stoakes , Uladzislau Rezki , Zi Yan , linux-kernel@vger.kernel.org, linux-mm@kvack.org, damon@lists.linux.dev References: <20230518171323.83828-1-sj@kernel.org> From: Ryan Roberts In-Reply-To: <20230518171323.83828-1-sj@kernel.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-5.7 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_NONE,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 18/05/2023 18:13, SeongJae Park wrote: > Hi Ryan, > > > Nit. For consistency of DAMON commits subjects, I'd prefer something like > "mm/damon/ops-common: atomically test and clear young on ptes and pmds". > > On Thu, 18 May 2023 12:07:24 +0100 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 check (and potentially >> modify) the operation. >> >> Fixes: 46c3a0accdc4 ("mm/damon/vaddr: separate commonly usable functions") > > Nit. The commit is only for refactoring. The original code camde from commit > 3f49584b262c ("mm/damon: implement primitives for the virtual memory address > spaces"). > >> Signed-off-by: Ryan Roberts >> Reviewed-by: Zi Yan > > Other than above nits, > > Reviewed-by: SeongJae Park Thanks for the reviews! I'll fix the nits you raised for v3. > > > Thanks, > SJ >