Received: by 2002:ab2:2994:0:b0:1ef:ca3e:3cd5 with SMTP id n20csp751399lqb; Fri, 15 Mar 2024 05:46:55 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX1I1To0rzTyyUXXoz5hQymXUbErxlpQCzaOUqyVhvazHS+TbvODY96ZQk+KSqvjHsI2+cuejJmN11q1FoVyL/gcQ++h+phuB1tz5K2kw== X-Google-Smtp-Source: AGHT+IEQ5Dgg0HVVjlkrYg414sofYLYKGQmtqxTPFtZzXmM/cKYJjxK1SaoY9O8/uZBqebmGEygD X-Received: by 2002:a17:907:7e9a:b0:a46:8c9f:f783 with SMTP id qb26-20020a1709077e9a00b00a468c9ff783mr1256333ejc.67.1710506815225; Fri, 15 Mar 2024 05:46:55 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710506815; cv=pass; d=google.com; s=arc-20160816; b=jVP7mtDgD3YyEFJcAF9+o2dJ+OwV1LZVJgvwbroy9bjVt6s75VtUMRbvKf8LVEtS1X Ozxt8d9RtLIDVjhgE6kRzzfDoCONgUDMVo2P9gH+BZZ89z09gNLw++fpaK9PEPlSf00w AOLst4/BFJ8rXY0B1Bagfm8JZY5GpKi40z0JrxAYnQsYBIIgGGY3/96zzG/XtiNj6u/I 9LpTaXIsH/rp8CXLhojeD74z+gO1SaloyTYZCKIiT9B+PO+ax6cZRN7qIKRdYQJ0PXuQ mv9cEEtsFCO3l2xh+ZkL43yiS8np0m2FMGrURfSV78RYEtABc4UIHyvB86814YZfQZ5b fn0w== 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=RULc5TDvvvk2Sa4i0hS8r0sd1mzoDamLndZ42uiOt24=; fh=cDRe+Le/GiTIw3gUU3zxIS0+S/D9b8Efj3qHkKW6jdo=; b=lXIWRH8i0dPA82g5n8MMpQ5HJTKB6JtmHx/3mumCyqAhsRlcpTOrD5Nu+OLuF5Xv+l cWNTmHZzPB4F09hJCJjhfsH3gtag6AileAiZU66q2KPibabOlpciv9os5nkbLHbcG0J7 TDuie3tdVTN7wskAPtIxdsDGcAQ/m2Zcq46xPX9jYATdvJMlAvWx19ufD0H7Rjn5Od0s +7JXkCMUsFeFl8oPiyOur41OhFYZrJA9gZo8l5zah/3rHmHOO8Gk/aW85JsdhOHEk9++ nN5LbHNo6Mj8nRioUM1N2yHFHSca8q2gMDdR+xmpQLAi08RnBA+SXT/+3eNgOLBstSKF rhSg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=sc4ciJQL; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-104410-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-104410-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 a14-20020a170906244e00b00a43c3c4a24esi1643370ejb.330.2024.03.15.05.46.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Mar 2024 05:46:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-104410-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=sc4ciJQL; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-104410-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-104410-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 EE9041F2160C for ; Fri, 15 Mar 2024 12:46:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 79A1D28DCF; Fri, 15 Mar 2024 12:46:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="sc4ciJQL" 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 D19952562F for ; Fri, 15 Mar 2024 12:46:37 +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=1710506801; cv=none; b=kcycNTOOm1UUO1KRDaw6sSN73J5hHbvpzpB77ukcYrV7IRZQ5n6ZNWvGAKTxRcZ93+zsG3bw/UjBM6wSUZLH03AvMHnQjxokjX/VIYXYGNTixDs6vbxSH7WLOoxY6OnyAYFKzuT3hKuiJe1kMagWEeGA+RY+byDbUec/C6l6aZE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710506801; c=relaxed/simple; bh=21ZuhUve5Z4tGe6WEXY6VmACIOFxRQiwQNAdgkxV90Y=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=KOAln7/vqMC1+jQcT2HRflHtthk6At06kaAaqhGNsRlHcmIanqkdmvoJReRF9ItC4acTUfu+Ue0V1wcxqAF2ZqvoIGcxTvKWcsiGsvYdzjtYBw5v4/dJ7TPklDElsgVVlC4nQEc97gCKrgqqCIlq0RD/bYLgzHsdME9S92Jt2Mo= 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=sc4ciJQL; 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=RULc5TDvvvk2Sa4i0hS8r0sd1mzoDamLndZ42uiOt24=; b=sc4ciJQLAJePL0o5DufJ89yc7j OOAdDOqyD/9x0si3c5ZBTDMPmvyMqSQrWGNl9DuK20mBE46P8EdI6u8OH9ZSeAorYxJYPkS2vFM/Z ymuLP9jLkMQg+ess5joFMU8O6VS1tgukLNdt84Vlgc0aQv/W+rqUMYhAM7g5oB6UAK9fG3lYqS1Mq p9cd/XE6FEHh0WLhb7aZcrgCRXDtHSkFgnFv5LiKuqw3snfQ2um4QWbMhkIv9BOyGuc5lbe+glarl HRwCwaX+wbMu4rfb7eBk8QiRZPTHKUlhbHdB9GjYMQFoJZ7oJJ4fNHEsmwRv1VgsSVD79Pq7zogQo WMHa81KQ==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rl6xB-0000000AGY7-3YBZ; Fri, 15 Mar 2024 12:46:29 +0000 Date: Fri, 15 Mar 2024 12:46:29 +0000 From: Matthew Wilcox To: "zhaoyang.huang" Cc: Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Zhaoyang Huang , steve.kang@unisoc.com Subject: Re: [PATCH] mm: fix a race scenario in folio_isolate_lru Message-ID: References: <20240314083921.1146937-1-zhaoyang.huang@unisoc.com> 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: <20240314083921.1146937-1-zhaoyang.huang@unisoc.com> On Thu, Mar 14, 2024 at 04:39:21PM +0800, zhaoyang.huang wrote: > From: Zhaoyang Huang > > Panic[1] reported which is caused by lruvec->list break. Fix the race > between folio_isolate_lru and release_pages. > > race condition: > release_pages could meet a non-refered folio which escaped from being > deleted from LRU but add to another list_head I don't think the bug is in folio_isolate_lru() but rather in its caller. * Context: * * (1) Must be called with an elevated refcount on the folio. This is a * fundamental difference from isolate_lru_folios() (which is called * without a stable reference). So when release_pages() runs, it must not see a refcount decremented to zero, because the caller of folio_isolate_lru() is supposed to hold one. Your stack trace is for the thread which is calling release_pages(), not the one calling folio_isolate_lru(), so I can't help you debug further.