From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 EB5DF2561B9 for ; Wed, 15 Oct 2025 19:59:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760558352; cv=none; b=FUs51Syr8heoT1+B1WHUoNAmCntV0p7P06aET/NcLFXUDy/h1YsgUpdu8rsyg6DEr2/mnqV+E1h/Gi1SozzXCTwOSz8Up1mioaZ/8KQ20UDxaV7ApRjFO6KCdt3Yck0OuzczzDjLu+BQuxOm9AvUU0ElUVfjEgh0JjCoeiZB/xc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760558352; c=relaxed/simple; bh=qWmg0NtlX9VEzTpgvqIlBglFj3zmXkbFtSVVHicvZOg=; h=Date:From:To:Cc:Subject:Message-Id:In-Reply-To:References: Mime-Version:Content-Type; b=KaMrOIvH1H1mv/f9nxFhHX/sLEjWJlB7fxMxlpGSQ+E7X475QgnUN5woghjUzWgrusqLsT+HTtQjC5KjVs9MGZnmWv8vXk+9FAwYaifXlBTEOqNQRaHkK0AinNPamt52P88VHyvhYVOafttPlQRcc+FQUkkSg4sXpagEkAMxn0w= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b=Qjt3Df5d; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="Qjt3Df5d" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A919CC4CEF8; Wed, 15 Oct 2025 19:59:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1760558351; bh=qWmg0NtlX9VEzTpgvqIlBglFj3zmXkbFtSVVHicvZOg=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=Qjt3Df5dghFnppzxr1Z54A55GDwmn1BhOWImmYBXkhS00UI0huJ55xgj1k80c9ZCu /mjbrq+At/yTHDeZQp+bSHvshZA9aoGwJ7X+0tUTXv4FG+GvMM8z1DDKrH9VY42TnN 9iHcaDGvEo4uwo2agKjlBrNA6kO1bIAE399RxTyg= Date: Wed, 15 Oct 2025 12:59:11 -0700 From: Andrew Morton To: Dmitry Ilvokhin Cc: Shakeel Butt , Kemeng Shi , Kairui Song , Nhat Pham , Baoquan He , Barry Song , Chris Li , Axel Rasmussen , Yuanchu Xie , Wei Xu , Kiryl Shutsemau , Usama Arif , linux-mm@kvack.org, linux-kernel@vger.kernel.org, kernel-team@meta.com, hughd@google.com, yangge1116@126.com, david@redhat.com Subject: Re: [PATCH v2] mm: skip folio_activate() for mlocked folios Message-Id: <20251015125911.0f0ebf87b278324667c4dfc5@linux-foundation.org> In-Reply-To: References: X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; x86_64-pc-linux-gnu) 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-Transfer-Encoding: 7bit On Wed, 8 Oct 2025 18:06:07 +0000 Dmitry Ilvokhin wrote: > > > + * They might be still in mlock_fbatch waiting to be processed > > > + * and activating it here might interfere with > > > + * mlock_folio_batch(). __mlock_folio() will fail > > > + * folio_test_clear_lru() check and give up. It happens because > > > + * __folio_batch_add_and_move() clears LRU flag, when adding > > > + * folio to activate batch. > > > + */ > > > > This makes sense as activating an mlocked folio should be a noop but I > > am wondering why we are seeing this now. By this, I mean mlock()ed > > memory being delayed to get to unevictable LRU. Also I remember Hugh > > recently [1] removed the difference betwen mlock percpu cache and other > > percpu caches of clearing LRU bit on entry. Does you repro work even > > with Hugh's changes or without it? > > > > Thanks Shakeel for mentioning Hugh's patch, I was not aware of it. > Indeed, I could not reproduce problem on top of Hugh's patch anymore, > which totally make sense, because folio_test_clear_lru() is gone from > __folio_batch_add_and_move(). > > Now I wonder does folio_test_mlocked() check still make sense in the > current codebase? > > > [1] https://lore.kernel.org/all/05905d7b-ed14-68b1-79d8-bdec30367eba@google.com/ So I take it that this patch ("mm: skip folio_activate() for mlocked folios") is no longer needed?