Received: by 2002:ab2:620c:0:b0:1ef:ffd0:ce49 with SMTP id o12csp618361lqt; Mon, 18 Mar 2024 20:01:33 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVqgtmtNaFebXszvjWQtknbW4rf+dRjisgjB8F6uFT1z6vV0hRdmW7C74TlftgVn+lM4HsGfTRsK//RrAiVeHtmVNLybea6SthI1N2bZg== X-Google-Smtp-Source: AGHT+IGYa/fHLRGErNEAgE59no7eiqOsLTTJXLcpDrsFSFJ3cNkPYhfbeyP+DYwPeFiV9Lf12DIS X-Received: by 2002:a17:906:c795:b0:a46:8c0e:4d5c with SMTP id cw21-20020a170906c79500b00a468c0e4d5cmr7134476ejb.3.1710817293168; Mon, 18 Mar 2024 20:01:33 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710817293; cv=pass; d=google.com; s=arc-20160816; b=Q3keAxYiZKs6oVzJpo+K8ScFHfqw6GePuxIg6AbN/orDzqAVlpYW5JmFONAAJfM0Vv BoKhe9jGFcthbP1BUuMMMHJsjy/S81itmLa+FhyLas1kWykzfXbrwGJae6gbgapBg3wJ JnXQQmLBimeL3fm44LZwfIF4TgGS7DAbsZ59y1ALYOiwrjzC6cxzAyN+NV35WZXrQv1Q zMrtPSAhVo4FGkfYW3noz+4y4fIsR5X4XjqWbKN7nu6d8aNmuffuOTLSy3qeYRG6tKJK CVUSN/f01eEEh4Z/RpYTVNQapbb7Ne1zqDoyOLcnEgAR5oovmQ6Hiuc0kywKEzd89NOf 2G2g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=q+r//xnTa4Swggn0SjTyOA2AYX42tQNVwNF2RqmybzA=; fh=oHVwDuUn2G0q/nBHwBMg+/uC92NaPvoReDtlYdC95QM=; b=lgoFPF2lwY6HHhScD9BDttn+KLJOSVJv3auFB+5nK6YtLr8kOWyNi9623T0WMu7Ux0 EBFiUAEBoel35Ro6Des2JkTqyUp26/59b617lL65+hqbfh7pWcH4Px5FkjH2sF62wFwL rES75KOLl8ZZwMa73yeXPUljwwx3hlaxpy2Ff4afOC5KlooojszMGc8WziOHko4dM6AA RtgeS4J2pnAPmhdPi3HUJ4fY/ZA1BID64K7jkodQP3AvusQMCwo214wyYhAvZYHH+tm0 VndWUrJFKI0lKp901pE6su6heFQUW2ePSe+26SfkrhNj4ZB+7JHg3+72SXqc3jtXIf5Z 2eGA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=PMBSEe31; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-106953-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-106953-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id x25-20020a1709065ad900b00a46525053edsi4682208ejs.877.2024.03.18.20.01.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Mar 2024 20:01:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-106953-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=PMBSEe31; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-106953-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-106953-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id CDC7E1F2221D for ; Tue, 19 Mar 2024 03:01:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 146B07BAEE; Tue, 19 Mar 2024 03:01:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="PMBSEe31" Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 291BC2F26 for ; Tue, 19 Mar 2024 03:01:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710817284; cv=none; b=F+2fic7FDduMsMTiiICF9wwwSmqoTy6VjHouxhLvi7UVJLuimT3jkg45phcsutJ0vz6hXW8dA5EUmn3BUBudPRxCCgI2+5KRXgoB1NvC3ISF1N5tJs0dSC340Lz+4O251plN4UcRLgKar0xPvfqHku+2vdITejOgAIZjrm9oiB0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710817284; c=relaxed/simple; bh=iOjqKZ1LMen7RBQYSaE3Rc5bvdCp6OclfyTv4S1fdZI=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=SLRcpjWPoP1Z+uCJfTNPgLBRTLnyMCJQ73oN8xe0SNj+Tdw1nv4TLwuUSUfUeLbzVFLVXGPOwiU7aPvSrIIcsOXk/1rtI+X3feMOp2GWI78moCC8o6TDgJNZxQxyrOxcSIC9LwyK83XWOXLHsyE5TOm3PERtaDhzq8qvulRmB8o= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=PMBSEe31; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=q+r//xnTa4Swggn0SjTyOA2AYX42tQNVwNF2RqmybzA=; b=PMBSEe318beFqCJgbQI+P4T3pF qOgVRjM+X23Ssfkd9/ZGzcfFX2sdwfFZDo9k9fn7wUf1EzKiEQuDycY4DTeheAfH4A5x/Q1Sd/Pmy NxG3invp4y+M0B0/XB+dpv1RV55s+VUm6Q9dOG49qFqu4p2EoXUJt5POAmPjuY7qZuOgCHAzzfHXe k3UZc4f41XmYRYfeRBX+3URVZzhzNpxYJrr85yvppFf11oQbxokIDemnZks+AuiczP2rZsa45tjrg x+o3jdyZZ3hCKNFpBJSYR90pwjeShqC97ZQO6VmBEgVhP/ph8UqiuHqCBXzxPkqpKucZIkKYMeBFn gKD/5L7Q==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rmPiz-00000000zr6-0G1V; Tue, 19 Mar 2024 03:01:13 +0000 Date: Tue, 19 Mar 2024 03:01:12 +0000 From: Matthew Wilcox To: Zhaoyang Huang Cc: =?utf-8?B?6buE5pyd6ZizIChaaGFveWFuZyBIdWFuZyk=?= , Andrew Morton , "linux-mm@kvack.org" , "linux-kernel@vger.kernel.org" , =?utf-8?B?5bq357qq5ruoIChTdGV2ZSBLYW5nKQ==?= Subject: Re: summarize all information again at bottom//reply: reply: [PATCH] mm: fix a race scenario in folio_isolate_lru Message-ID: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Tue, Mar 19, 2024 at 08:48:42AM +0800, Zhaoyang Huang wrote: > BTW, damon_pa_pageout is a potential risk over this race No it isn't. struct folio *folio = damon_get_folio(PHYS_PFN(addr)); if (!folio) continue; if (damos_pa_filter_out(s, folio)) goto put_folio; folio_clear_referenced(folio); folio_test_clear_young(folio); if (!folio_isolate_lru(folio)) goto put_folio; if (folio_test_unevictable(folio)) folio_putback_lru(folio); else list_add(&folio->lru, &folio_list); put_folio: folio_put(folio); It clearly has a folio reference when it calls folio_isolate_lru().