From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (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 0B6F52D3755 for ; Thu, 18 Dec 2025 03:32:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766028724; cv=none; b=m5Oya+N6rKIYoHLTcp46bBN3NtRvjViIliE2e6UoRKKjisNYr2oN3h6Jn0J1z8lSDTtMvdiGqqS4E9fXerNIw0yxVsHIBizBs6mjM353vTe18LJZupKf2JH3Tjdk0/MYARRDrATll18gSp6jZRKbD6QAuH8QCxxVnH4HeWZBcWU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766028724; c=relaxed/simple; bh=8OLJDjknF/uYTpfpuVM5CpittMjkqMx8HvgMH0cAOro=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=hB1R9YnxsTyIznB04bxgIUr8VleALVwcsAi7mdJ6cw0M2d9eoT6xjH9O+pzldn4SLdeh4gvzE+i3l9E/7xfsmbkHoJWuZyknzMMuvXV4JYnsGgqBK8EeciycEYALrJUpm885bb2fm7D2qnevW1IJUnp8nL2JiJWyje3hvDMgIHk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=YY+LX1yK; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="YY+LX1yK" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1766028721; 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=UsdkpPRWds07wTB0hbxgdZlH+FRjloYj0TiP13tyXec=; b=YY+LX1yKzcwmapkbXcXC1jrT552EZfOsg11DM0gG071wyf2uPcRaxmpKaMYDBit9GOCbiX Od6Wc8EjwwTxYt0yyNqMpJaaUE8KEJieW+t03oMz9NMWyezCFD4V+uyWEBsIXSziAkSw8w gmXkyBeBfyX82xy4PWd6PfosAAJmHzA= Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-651-r7BxuS-nM3CihuZPqJZm1g-1; Wed, 17 Dec 2025 22:31:58 -0500 X-MC-Unique: r7BxuS-nM3CihuZPqJZm1g-1 X-Mimecast-MFC-AGG-ID: r7BxuS-nM3CihuZPqJZm1g_1766028716 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 7A36C1956063; Thu, 18 Dec 2025 03:31:54 +0000 (UTC) Received: from localhost (unknown [10.72.112.95]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 35F2A180045B; Thu, 18 Dec 2025 03:31:50 +0000 (UTC) Date: Thu, 18 Dec 2025 11:31:46 +0800 From: Baoquan He To: Kairui Song Cc: linux-mm@kvack.org, Andrew Morton , Barry Song , Chris Li , Nhat Pham , Yosry Ahmed , David Hildenbrand , Johannes Weiner , Youngjun Park , Hugh Dickins , Baolin Wang , Ying Huang , Kemeng Shi , Lorenzo Stoakes , "Matthew Wilcox (Oracle)" , linux-kernel@vger.kernel.org, Kairui Song Subject: Re: [PATCH v4 12/19] mm, swap: use swap cache as the swap in synchronize layer Message-ID: References: <20251205-swap-table-p2-v4-0-cb7e28a26a40@tencent.com> <20251205-swap-table-p2-v4-12-cb7e28a26a40@tencent.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: <20251205-swap-table-p2-v4-12-cb7e28a26a40@tencent.com> X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 On 12/05/25 at 03:29am, Kairui Song wrote: > From: Kairui Song > > Current swap in synchronization mostly uses the swap_map's > SWAP_HAS_CACHE bit. Whoever sets the bit first does the actual > work to swap in a folio. > > This has been causing many issues as it's just a poor implementation > of a bit lock. Raced users have no idea what is pinning a slot, so > it has to loop with a schedule_timeout_uninterruptible(1), which is > ugly and causes long-tailing or other performance issues. Besides, > the abuse of SWAP_HAS_CACHE has been causing many other troubles for > synchronization or maintenance. > > This is the first step to remove this bit completely. > > We have just removed all swap in paths that bypass the swap cache, and I think we didn't remove swap in paths that bypss the swap cache, we just add folio to swap cache in those swap in paths where swap cache is bypassed.