Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp3286351lqp; Tue, 26 Mar 2024 05:22:16 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX4IkTqUSe+SWl0vstG8QqvNEHNVQTzPQ40JBhqWjSfZeF3Lq8a66px6+w0bdX01kjM/eGScBcn9RskZE8hTARQCycNMv4MbjQMme5THw== X-Google-Smtp-Source: AGHT+IG8mxEieHKcnv3xbCYhLN9eB+NxYLBJ85voIE47s9ipaFQi4OtefZtwhgmYJ+jRj50lWq4z X-Received: by 2002:a05:620a:2408:b0:78a:4ec7:7d63 with SMTP id d8-20020a05620a240800b0078a4ec77d63mr1666183qkn.13.1711455736291; Tue, 26 Mar 2024 05:22:16 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711455736; cv=pass; d=google.com; s=arc-20160816; b=fAwqt1EACyy9rWY8HwM3yMzvabplDWxR74fC9RR/4vn2/n7Ei7LRTmNXcnuM2TUEgD 5VMXRpzjeOvUH+n7m/j9fLW96Upd5Jw+yGOxjNFGrZFalNHPUKjshhcrbn1/guR2TbD9 v1tPC0Vx5m+nbmNG5Owsle0ftLGvJJK6Q/9w4rZcLjOzIsOALTfBWfObNQqkcTccOAgh 57Xt1HOXmHZIaBYB+BkWijkgDONlaFgs9J2xCcDxw025ppDia2eNDZLTaxfTNbtI+1NC Kq5p1ZshbVpENU7L9k7wWOLxo78zCBw6AFSryTY97xaPcRFcfevbX4s7fc9KLAQ2Nmg6 /Rrg== 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=FZXEPvoG9Rls8PIO0odIAJYGvb7rtlOkN7UCiLUWwBk=; fh=oHVwDuUn2G0q/nBHwBMg+/uC92NaPvoReDtlYdC95QM=; b=c//pWBXBviybK0PyXi6M4b+aDj2ikhvd18Ycu4KuffsWs3m8diUl/3cJR6xJmVQJDN iALMxULDJH7FddjWymPIyXehG7kkExKOlVyurVBLp8So7t+VJ/1v6jaFSwbJ4hJ59X74 hgbiPo6u9pRR6galtQjWi+G2cq+f3zey6FE3ls+DdtnHxXKhWumDCavNF9Uma52mYy8i JE3Q9cJsMPn4hSI6JQCbzJSMfXEsK1ScvS+0t28f6guKy/woX9L5VTeKokk7pmPtDfdQ Jy/VRXOKVw2IgM5Ba8hMrVw8qC3d45jnsSUZ6ci0gMbgC8e0Ln+xu/DPFuT/vyhSppyA v68g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b="Md/x4yH8"; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-118961-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-118961-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id v26-20020ae9e31a000000b0078a29dab24fsi7387202qkf.208.2024.03.26.05.22.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Mar 2024 05:22:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-118961-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b="Md/x4yH8"; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-118961-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-118961-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 0B9701C2D0DE for ; Tue, 26 Mar 2024 12:22:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8317D7316A; Tue, 26 Mar 2024 12:21:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="Md/x4yH8" 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 DD22971B5E for ; Tue, 26 Mar 2024 12:21:48 +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=1711455710; cv=none; b=b5IbVHOEZ8ANY1HqAiqqBzLETDccI5WMWgj8Zyr3mrfoRPyMsh1AELoZDwosSWyOpmhWPQtArPSsq6c8erMJLT21IYGqgqFGtLmIKI3GMuoQm5ZOiVOWb8W83EIPSDPRMXqfxfvcHsPaQIMQORhnkqYJA8qQpe3RoEorUioCMVY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711455710; c=relaxed/simple; bh=+HULUAtlNQ3MvWiH8WLL0jBlfjkDhhBdZ5vAO5ZkBLY=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=iaLjo15EdUiU/gOk8q05nNBzV+vkAlA07tLicA/ixSZoqobUHhgRmReER31jATPijrDEHWSZoM/k+EAlJ/IH86oBB0AGGE8L2BoUMHVAcy8WnKlYWAi6q9RvWfVxSKMFJtFCWZtawIKQpncCV/MBTnjj0QjV8E5dyFHltBE6990= 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=Md/x4yH8; 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=FZXEPvoG9Rls8PIO0odIAJYGvb7rtlOkN7UCiLUWwBk=; b=Md/x4yH8d9E5HoKw0wvTvsk+wZ FJOVgTvLxA35NtYaTkHPJM2R941CMY/A8v/mwdaj/fObKchdnHAfY7IntSz9j2um8iKECpAcumTDl HaA0ESdg3j0QFb3gtJDnnaGCsYNZ5GRylQavSE5uUQ+1t+W6B4GnaJmUZAuSORsEk3C1OA5zCQsPr 2B8x8/dhmDdMqGPArmN7PCawWhksFelmn8lq+yr2hJayEfOJcF12krpr9YKfzACqx6ojX36RT4g6M hQzzM7xCt+b8u92+rv9c/pQY9LUV1UIN46M30Ohmd6CpurctTmLZ2ytLcKpecm9xbvUhmUf3L8hRA k5eILGxQ==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rp5oC-00000001FQ5-46kw; Tue, 26 Mar 2024 12:21:41 +0000 Date: Tue, 26 Mar 2024 12:21:40 +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 26, 2024 at 05:06:55PM +0800, Zhaoyang Huang wrote: > 1. Thread_readahead remove the folio from page cache and drop 2 refcnt > by readahead_folio & filemap_remove_folio(get rid of the folios which > failed to launch IO during readahead) > refcnt == 0, PG_lru == true, PG_lock == true > read_pages > ... > folio = readahead_folio > > ********For the folio which can not launch IO, we should NOT drop > refcnt here??? replaced by __readahead_folio???********** > folio_get > filemap_remove_folio(folio) > folio_unlock > > folio_put Ignoring any other thread, you're basically saying that there's a refcount imbalance here. Which means we'd hit an assert (that folio refcount went below zero) in the normal case where another thread wasn't simultaneously trying to do anything.