Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp10468567rwp; Thu, 20 Jul 2023 22:51:29 -0700 (PDT) X-Google-Smtp-Source: APBJJlHZWEwmSi2V0TGSDrL3zOouBFWHumAn1w3B3ullN8sE+L62j7EGjXEFzRJNEWD58MPzWx1q X-Received: by 2002:a17:906:768c:b0:993:f4cd:34dd with SMTP id o12-20020a170906768c00b00993f4cd34ddmr1027596ejm.34.1689918689453; Thu, 20 Jul 2023 22:51:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689918689; cv=none; d=google.com; s=arc-20160816; b=BylO2jAs7NnuCQN/Rgx2BWpT3DzP2SndAWZpAj/ywh9/gJ8V4OxzDWgGy7icU2NC/6 WOsGYIfcZVLtenCsfJvQ0aG04G+u2qa66+6Vm782Q17t7MKP1QUmx8M0Cg8X+nvfkI3I txIq1zle8xSe4g6bjSazdF3rCC9jHp2z7eYKThzlVvyiM8mR9lxkhhubtiobSsvy2Y4m 7NaG1pYe46v4tRuNPgrDPcEaNGkF1pSAs/4LaHxx02npPOvwZNPcpkkP961AShlpkL/l U2zRFVZIpOSISoEQVlCElAmsFu1Q5igbS/q/d9xGPLJk1+NB67h15zi4E8L4cKsd3UCo t7tw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=OyCkBaxm3KJrw96ytVBxzghcNRSZ23BN2/Zj+qsmnvI=; fh=9qJ3rQsR/XX03eenCeHO8H7Z6eykqObIuCNjf/xKqHw=; b=STRotJbq33r1pItkfXyQK/HcigSEvHoMYTf+saGiPtnYyZAIpD99M9boCfm+b1s5cG vMDNRSCCEskzwFNZzOSH1/eN0MxYa3JvNUHFOz1xMq4xRIK2KeDppgjbWNlwJP+iY06z jzyHmUQDjHIqbpIeN6krrsAwFexQtWhk2j1dZ7OSJIYw+B7uHPnYOl0j3yd2nj0zmOf3 zNUXcBJSZq6jq8I3q9eoMjXkKOe4Bjgc3CnleVqBe+pkIqz3dPKjiro5S+38AHc1sCyF eYFv1qkS+issC9G51vvnFEMQAKOjV7Mrcgk27XiSxLAAQX9/UzPHVmi5c17YrgB2xfNp rQrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=eB4YsL4n; 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=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k19-20020a1709063e1300b0098e2edf7479si1794346eji.858.2023.07.20.22.51.04; Thu, 20 Jul 2023 22:51:29 -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=@linuxfoundation.org header.s=korg header.b=eB4YsL4n; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229709AbjGUFS7 (ORCPT + 99 others); Fri, 21 Jul 2023 01:18:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56076 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229450AbjGUFS5 (ORCPT ); Fri, 21 Jul 2023 01:18:57 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 80C23B4; Thu, 20 Jul 2023 22:18:56 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id F3B776106D; Fri, 21 Jul 2023 05:18:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B047DC433C7; Fri, 21 Jul 2023 05:18:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1689916735; bh=TTI/GlElwDYyih0KOVoE5zW1kAkMrgogNBmCmy5UeQk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=eB4YsL4nxl0qIm/TpuKDY5S2GXuAh7qGicWKVqPsmqj1DSokXbdb4/nHPW8ZQI4Ug vP1f7ciEphR0wgaHQ+b7zviAYPPivdW7iK2rb12SZWX0YiDJFaZwygnyLFw4aZgtUH 0GCssRGE0VB8x3pHjshGBuCRKO+snluglPtNdOYo= Date: Fri, 21 Jul 2023 07:18:52 +0200 From: Greg KH To: SeongJae Park Cc: ryan.roberts@arm.com, akpm@linux-foundation.org, hch@lst.de, kirill.shutemov@linux.intel.com, lstoakes@gmail.com, rppt@kernel.org, stable@vger.kernel.org, urezki@gmail.com, willy@infradead.org, yuzhao@google.com, ziy@nvidia.com, damon@lists.linux.dev, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 5.15.y] mm/damon/ops-common: atomically test and clear young on ptes and pmds Message-ID: <2023072144-item-cosmic-5c73@gregkh> References: <2023071613-reminder-relapse-b922@gregkh> <20230717193008.122040-1-sj@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230717193008.122040-1-sj@kernel.org> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,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 Mon, Jul 17, 2023 at 07:30:08PM +0000, SeongJae Park wrote: > From: Ryan Roberts > > commit c11d34fa139e4b0fb4249a30f37b178353533fa1 upstream. > > 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. > > Link: https://lkml.kernel.org/r/20230602092949.545577-3-ryan.roberts@arm.com > Fixes: 3f49584b262c ("mm/damon: implement primitives for the virtual memory address spaces"). > Signed-off-by: Ryan Roberts > Reviewed-by: Zi Yan > Reviewed-by: SeongJae Park > Reviewed-by: Mike Rapoport (IBM) > Cc: Christoph Hellwig > Cc: Kirill A. Shutemov > Cc: Lorenzo Stoakes > Cc: Matthew Wilcox (Oracle) > Cc: Uladzislau Rezki (Sony) > Cc: Yu Zhao > Cc: > Signed-off-by: Andrew Morton > Signed-off-by: SeongJae Park > --- > This is a manual backport of the commit, which cannot cleanly > cherry-picked on 5.15.y[1], on 5.15.y, specifically 5.15.120. > > [1] https://lore.kernel.org/stable/2023071613-reminder-relapse-b922@gregkh/ Now queued up, thanks. greg k-h