Received: by 2002:ab2:b82:0:b0:1f3:401:3cfb with SMTP id 2csp178186lqh; Wed, 27 Mar 2024 20:18:45 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXldlhT3Jbp34PfmIDpHYloUJ6Z+cf0zd3Ht7WOpkC+isemy9qvsY8h0q9IZna6u/EiC4MdJYO8BVx4UIU/UagEcDcSoeTuCayWaJHA/w== X-Google-Smtp-Source: AGHT+IE1ExcF85azCjg6U+MgIcXzwNIeZGcSlx8OieiTw38j9JEbtSDpdGCI8KA+7/pi+uZco1Gu X-Received: by 2002:a19:8c47:0:b0:513:d372:20f7 with SMTP id i7-20020a198c47000000b00513d37220f7mr836521lfj.21.1711595925680; Wed, 27 Mar 2024 20:18:45 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711595925; cv=pass; d=google.com; s=arc-20160816; b=RSZlkiTDbOCqf0jxEMiopLRqZSmtKc9cxKAFIdh2kYMdiE6ZIW5d7mLrz28/ObiCLA pZKDOevf2M+bbdroviqcyFPNVQ1h31K33WnYbwpd/t2nj8q4fNv37MVdcNJSA6qrTxzs sj2lS2RfpkFr2Lnlx+z7Uy32zJwIDS53xNDKrMBCIQ/sIe4uKSdu/c0583ZYXik0oCir sbXRSdJGLjflIVz8J0iF2j8Z3PbvX5GjqA0zHbAtJkiQI+xfjp7kbbXh4HB5pF7iinlB 5+PdTU2AHG4YjuRkjW+mNrABQG91l1qpMdwYTHV+KAQsrYRqVo37N3BDrbR72rTR3zeL E6eQ== 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=667BZ75JN63p2WibLec/d2R/US6udjc5iPxuUlTOhFo=; fh=oHVwDuUn2G0q/nBHwBMg+/uC92NaPvoReDtlYdC95QM=; b=KZV95HThhMsz1aSW5wObGWmowGQDq+VCfKD+BnAL9JHaf+EAttyBIkjpxIIrldpu/t 4FQRN7CHySweU+EP0oWZDRjWkpKARpKqsbKjscyXIj2CrR9+LnTvX66WtA8XQnXkLyhz n5d+JQIsDhRAo/AfoYTqY/oaZQv7PjnuYocbC8DawqEOaKnrEG2uVhPWqKEj91Y7tute rM/4e/Evqudh2H9C8zdfb3Qu9YtCmCclXMWwqPcsJn5hivsDoZnr56lBr1RV7FJoOJFs k1VwPOs2me480a2sZQrG3p3X895VGP1HCKDlxlh2bQxu6tg+WLzYDGt+AbUBRlN3a1eA GfIg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=rBPk926m; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-122373-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-122373-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 s26-20020a50ab1a000000b00568a525788bsi292026edc.553.2024.03.27.20.18.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Mar 2024 20:18:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-122373-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=rBPk926m; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-122373-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-122373-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 653A11F2BAD8 for ; Thu, 28 Mar 2024 03:18:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 155322D60A; Thu, 28 Mar 2024 03:18:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="rBPk926m" 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 E53642E405 for ; Thu, 28 Mar 2024 03:18:35 +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=1711595918; cv=none; b=jX0eruN+jNivoaP1+Ia7qQwvCZIZGo3Y7uH+4mIBvAkr85gPcgSRwG2nEpXwPtIZEFxNKFQrUFt4u9H+tdQIAVeLj4mPdPu5geanTh9rePl6ypsHzZOLzNK6sUCuRX0O72WtC39CKvtHLXrCi6kDKREFNUi7Mq3rL0oWs4pROKI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711595918; c=relaxed/simple; bh=5vFqVpmltv+FRFSlK6Bry9PygRX8oCEWOYykkGWoI1o=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=bD/ctGj0jpiUT1gpsQUymkBCzr2EzHN/8BGxRYKaWbQBrm21sgy2WQl8jsvskr3UeezFpcdiJ2uAwr/EewzkiP2LPP5lhwlcRUEIJRpPmjcF86wgZ/Fgbbs/B/BlhVLs/9aTZYTvcjnwF3XxRoQZ2Tlk83nLzRzoDNtZKDEZlJE= 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=rBPk926m; 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=667BZ75JN63p2WibLec/d2R/US6udjc5iPxuUlTOhFo=; b=rBPk926mRFY/QwL4bURPl80+6M fLu3StBjBVRVOWOT1NG3We3/FABD4QBgwrR7DHPnbZGCoJgTpFWYTmxp+ZjFR4t2RVnT6GrfNsyAu mGkCQJxickvizzyG2eRgE5NDTBHvgtI9GaBeluZgbdXBY/Q1QjFaAjI6HbLp3xY+wXi0KIdoMJ48j p/IRKSWNb/9wBKFoZiL0dw552yb2sf8+Ct7+ajSCevLC3sPLRBttVN2ocj8d9Lt3w8wZprj5Bs4qs FPlb4i9N7lHMWIFl0i2RICuNKiM35jyryq0QDlLWQT1rb42Zp8qMgnSS3YjMjgj+klAGA1SKiCUDh NBR4wcgQ==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rpgHb-00000005O6U-43VH; Thu, 28 Mar 2024 03:18:28 +0000 Date: Thu, 28 Mar 2024 03:18:27 +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 Thu, Mar 28, 2024 at 09:27:31AM +0800, Zhaoyang Huang wrote: > ok, I missed the refcnt from alloc_pages. However, I still think it is > a bug to call readahead_folio in read_pages as the refcnt obtained by > alloc_pages should be its final guard which is paired to the one which > checked in shrink_folio_list->__remove_mapping->folio_ref_freeze(2)(this > 2 represent alloc_pages & page cache). If we removed this one without __remove_mapping() requires that the caller holds the folio locked. Since the readahead code unlocks the folio, __remove_mapping() cannot be run because the caller of __remove_mapping() will wait for the folio lock.