From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-182.mta0.migadu.com (out-182.mta0.migadu.com [91.218.175.182]) (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 328C03AFCE3 for ; Mon, 6 Jul 2026 09:13:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.182 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783329190; cv=none; b=SV9wRfQSBbPTELAh0uRvJmReEaezhUcv3DAuFDDywQMp04tpxLfPj2amc0Ifr35MU7JYJmPyYaCYAVWKLQY9FHW7vWBJEbYa83O0cg+SDzp1qmiKBy6Q8I3zIg1QcVcpdIKFBy84H3pfStuiejvE1J+zmy337tnOhVCnXCSO+qY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783329190; c=relaxed/simple; bh=Isrdp12fjHo65nJmUzN8ZahHWHF+W8ZSLopev6na1/Q=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=XuLGBUn998ba7SpfycdBKcHRRHbowufHQ2KI2Fh35e9LFbwjbI7kwnH8LInHdyAjlcQoNSFMIrHk3Eul8p8CzKY23dYLNW5YQJOlQwHH9+JmiSMoR4k/MrR/xDGHJ6Lbt5XY5ISIkL6KfCWn86hUIP9XqAuK+vrmrXgrUdTrZeE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=JxxtGstz; arc=none smtp.client-ip=91.218.175.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="JxxtGstz" Date: Mon, 6 Jul 2026 17:12:48 +0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1783329178; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=naoHFztrbYuFdXjk2Az0KSA/pBNbZzEdILKeRrHL4Ys=; b=JxxtGstzVWYQajFrhm7zheyDPkIiaPm/VkikWt1KgDoeMnKBc7+G84Qkz4FAfc+4Anilac tki5u2P7T4VAN54VBuWXV3FT/LD+hC40551vu6c1Ox81KobLA0TeWRp2zmTdMx6dqqlyfX VpKWUerlDUCA6IHfv+nDnk4T/AYZg2k= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Baoquan He To: Barry Song Cc: "David Hildenbrand (Arm)" , kasong@tencent.com, shakeel.butt@linux.dev, akpm@linux-foundation.org, linux-mm@kvack.org, chrisl@kernel.org, jp.kobryn@linux.dev, liam@infradead.org, linux-kernel@vger.kernel.org, ljs@kernel.org, mhocko@suse.com, nphamcs@gmail.com, rppt@kernel.org, shikemeng@huaweicloud.com, surenb@google.com, usama.arif@linux.dev, vbabka@kernel.org, youngjun.park@lge.com Subject: Re: [PATCH v3 1/4] mm: avoid unnecessary lru drain for wp_can_reuse_anon_folio() Message-ID: References: <20260701235955.36126-1-baohua@kernel.org> <20260701235955.36126-2-baohua@kernel.org> 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=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Migadu-Flow: FLOW_OUT Hi Barry, On 07/06/26 at 04:18pm, Barry Song wrote: > On Thu, Jul 2, 2026 at 4:05 PM David Hildenbrand (Arm) wrote: > > > > On 7/2/26 01:59, Barry Song (Xiaomi) wrote: > > > There is a case where `folio_ref_count(folio) == 3` and > > > `!folio_test_swapcache(folio)`. In that case, both > > > `folio_ref_count(folio) > 3` and > > > `folio_ref_count(folio) > 1 + folio_test_swapcache(folio)` evaluate > > > false, causing an unnecessary local LRU drain. > > > > > > During an Ubuntu boot, I observed over 5,000 redundant local LRU > > > drains. For a kernel build with a minimal configuration, I observed > > > more than 20,000 redundant drains. > > > > > > Fix this by checking against: `1 + in_swapcache + in_lrucache` > > > instead of hardcoding `folio_ref_count(folio) > 3`. > > > > > > Suggested-by: David Hildenbrand (Arm) > > > Reviewed-by: Kairui Song > > > Acked-by: Shakeel Butt > > > Reviewed-by: Baoquan He > > > Signed-off-by: Barry Song (Xiaomi) > > > --- > > The other folks should probably re-review this patch that changed quite a bit :) > > > > > > Acked-by: David Hildenbrand (Arm) > > Thanks! > > Hi Baoquan, Shakeel, and Kairui, > > Would you like to re-review the patches so I can re-collect your > tags? If not, are you okay with me removing your tags when I > send v4? Is there change you need to do in a new version? If yes, please remove my tags, I will review v4. Oterwise, I will check this v3. Thanks. AFAIK, usually, if patch is updated in a new version, any reviewing tags from the old version should be dropped unless the change is minor or trivial. Thanks Baoquan > > The concept hasn't changed since v2, but the code readability has > improved quite a bit based on David's suggestions. > > Best Regards > Barry