From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-176.mta1.migadu.com (out-176.mta1.migadu.com [95.215.58.176]) (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 6421B428472 for ; Thu, 11 Jun 2026 18:40:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.176 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781203213; cv=none; b=UlF45xAAOiyk8+p5Dz/+E5U/bRoBLUmzovi2cwRebMf9qUd42ebJwKbsuXf+V75hvla5/+XuaZlCDBOkEd5k15EkBxe30Qq8qFFs1S5HTzQdGR5hjisGxL3QbpBVGTBQBdj1QeWfV8B4GNhaeRuTJUVrmMoVATSm/YweFK5bIRY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781203213; c=relaxed/simple; bh=051MNzMb9l5HYj1Xgi7nC8syLA5dRkch+bRjW1MEEBQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=BNlPU9qaoPLu27SsmP4LG5phLAZ6g3tFzRAV9yh5rSp3XS5AiP1teWP48eEV85C4cccdbjc2OOBZXV9necyLg5czXDcM762s0Nm/Vxm/seoAiR/h8M48C65I6Z5cG9Qtn4YfWMyAMlz80NMbBcEF0PrSLa/S9khcoRjW2Peie88= 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=aWhrfyJH; arc=none smtp.client-ip=95.215.58.176 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="aWhrfyJH" Date: Thu, 11 Jun 2026 11:40:03 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1781203209; 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: in-reply-to:in-reply-to:references:references; bh=9wzhsohGL4NN0J+0elGR6up6JkxV2fvsVc7Gd9mwW1I=; b=aWhrfyJHczYiAW+e7CbyKhPyH4/r8mKsb6EcANV1BPJIZS3AxGqU9MsO3NJK5q067qHkVZ 4qUCYyvYkBQuRyF1DmRAm1ZaEi4wmeMcTyeoaWucoo2bgku3ByiuagDcXNmRO56lIJo4dP Bkd80GjTuDJhJgZ28tXvJOfHpytRgI0= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Shakeel Butt To: "Barry Song (Xiaomi)" Cc: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, david@kernel.org, ljs@kernel.org, liam@infradead.org, vbabka@kernel.org, rppt@kernel.org, surenb@google.com, mhocko@suse.com, chrisl@kernel.org, kasong@tencent.com, shikemeng@huaweicloud.com, nphamcs@gmail.com, baoquan.he@linux.dev, youngjun.park@lge.com, jp.kobryn@linux.dev, usama.arif@linux.dev Subject: Re: [RFC PATCH 3/3] mm: entirely remove lru_add_drain in do_swap_page Message-ID: References: <20260611105124.98668-1-baohua@kernel.org> <20260611105124.98668-4-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=us-ascii Content-Disposition: inline In-Reply-To: <20260611105124.98668-4-baohua@kernel.org> X-Migadu-Flow: FLOW_OUT On Thu, Jun 11, 2026 at 06:51:24PM +0800, Barry Song (Xiaomi) wrote: > We are doing a lot of redundant lru_add_drain() calls in > do_swap_page(), especially for synchronous I/O devices. For > example, the test program below currently ends up draining > lru_cache 100% of the time: > > int main(int argc, char *argv[]) > { > int i; > #define SIZE 100*1024*1024 > while(1) { > volatile int *p = mmap(0, SIZE, PROT_READ | PROT_WRITE, > MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); > > for (int i = 0; i < SIZE/sizeof(int); i++) > p[i] = i%64; > madvise((void *)p, SIZE, MADV_PAGEOUT); > for (int i = 0; i < SIZE/sizeof(int); i++) > p[i] = i%64; > munmap(p, SIZE); > } > return 0; > } > > Folio reuse now relies primarily on the exclusive hint, making > lru_cache draining to drop the refcount in lru_cache largely > irrelevant. > > Signed-off-by: Barry Song (Xiaomi) Acked-by: Shakeel Butt