Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp810891rdb; Fri, 2 Feb 2024 05:01:04 -0800 (PST) X-Google-Smtp-Source: AGHT+IGWktN2yrP4vIeVNK/LtAZH7373WCpQC+NvpljsLyhZUZv7MvLjYHU9h4blc1072gSLoHqI X-Received: by 2002:a05:6102:419f:b0:46b:58f1:4c0c with SMTP id cd31-20020a056102419f00b0046b58f14c0cmr6692614vsb.25.1706878863491; Fri, 02 Feb 2024 05:01:03 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706878863; cv=pass; d=google.com; s=arc-20160816; b=oeh9bhEZvY50Tl2IvuzlvAe0a28aQ8q5oqfVSloUENh9tfNdip/4Co1f8e2Eb8iVJM Eo3vG2DuiBOTjLEr+VfMOOruntOwyTcn0Vd9P3LIrsLwRO3ma80gaAcGFtjygmm+7imI xDEyc3/65Mt84WVBdFLWWm6YOpDcMf/YV5jTKKaCYHueheBsWKbr3aTPxz+Lhpmai+Xn +RydZrO56e31jpGpte7XU25Q74UqsrZ+hsSN7hkp2++F7JpKY/k/kSGROlhxGyMj2e6S zrGNGO+2XvwxKjvMd/0mCvFhne0d/DF55FB/zjvOkRQJ/+HoHvnWIS/zprRoxy3XEPxu m7ZQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=G2bY4vYtweXh8leJIICu6NBbyGqLWwvL3EkmAcH4Epw=; fh=QSQ3I3J4cVvjgpmcpg4lAfwyr2NSqPwgeT+SyG720R8=; b=Y3a4PaYk7Q5xwWNlCskCy3y65wLiktamoJNwIOJ20rMqp0wfjC0GZq4OdYviWadD2l VWErpGqJh5GhmkYbdrriG5mg/FbJt3OiRDJQ0IgD4JKs6UTrb2HNgQFav3AKHT/twEcC QznUPGrqUl2FtO3PqXvBW20B0T1hlAK4CHgkHd+C2NSV/RF9M3cabGNY2ZJLTNq+Lyy+ TdZgHVWNXfHluN4JNTCHIyOvKdvpncfWy08xVZq90AzPRtL0BAM/Jary7x2VB8F13jG4 0PeTiEz5V0+tf5DaTq1p4Q+GEzrlEHjiS/MMviXcJxmvXr5srhi+bOTG1NyI7uqXaMOP 4Udw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bytedance.com header.s=google header.b=daY6KNGu; arc=pass (i=1 spf=pass spfdomain=bytedance.com dkim=pass dkdomain=bytedance.com dmarc=pass fromdomain=bytedance.com); spf=pass (google.com: domain of linux-kernel+bounces-49874-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-49874-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bytedance.com X-Forwarded-Encrypted: i=1; AJvYcCViGCt2u+TmKF3jrc11JTrmDwPBiiqkv/ZIpwksD2FpRvg41jEVfYel4O4Q7D38Hw03cZ1hBt/x+Gsp2JEN7L3qlynX8rjhUGnxSBPmlA== Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id if7-20020a0561022c8700b0046b144eeb0asi230087vsb.388.2024.02.02.05.01.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Feb 2024 05:01:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-49874-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@bytedance.com header.s=google header.b=daY6KNGu; arc=pass (i=1 spf=pass spfdomain=bytedance.com dkim=pass dkdomain=bytedance.com dmarc=pass fromdomain=bytedance.com); spf=pass (google.com: domain of linux-kernel+bounces-49874-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-49874-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bytedance.com 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 3B82B1C22983 for ; Fri, 2 Feb 2024 13:01:03 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 27B9A4402; Fri, 2 Feb 2024 13:00:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bytedance.com header.i=@bytedance.com header.b="daY6KNGu" Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D1F7A1FAE for ; Fri, 2 Feb 2024 13:00:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.174 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706878855; cv=none; b=mwlmaPBHF96IawVGGQqvj1cP7laxRPyDkSTC8DFBVcVaS0urw5HIhJRF7//Yr8eflekEx7eDgUm3AIwzJaqqszgE5bF+zTsNGzTdtdluLXMJ1UGAU8x18Mt+wnmJOk+w4fSpL2pGN0qL3sqf1qoH8FxysLpAJf2NrCtII+i3HBA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706878855; c=relaxed/simple; bh=Aq+wlET4B4qpqujfc2Oa2FfWuD8TqO2VxciLRWvXYIA=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=IFdA6Uox9wzqAMfBE/+ln71HjaUJOc2+TIfnwiL4FlDmCFELZA3nawQbapNfU/nqYvn5aymnUVxdW6S2T2662L1pHIxWNWSK0LMqLRhGrQeDB16QWnkpPP+/H0fnfCNc46Lon+BnGaYLa9DLsR8hXwEGgyAdavQZoUg08dM7Xas= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=bytedance.com; spf=pass smtp.mailfrom=bytedance.com; dkim=pass (2048-bit key) header.d=bytedance.com header.i=@bytedance.com header.b=daY6KNGu; arc=none smtp.client-ip=209.85.214.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=bytedance.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bytedance.com Received: by mail-pl1-f174.google.com with SMTP id d9443c01a7336-1d746ce7d13so16997815ad.0 for ; Fri, 02 Feb 2024 05:00:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1706878853; x=1707483653; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=G2bY4vYtweXh8leJIICu6NBbyGqLWwvL3EkmAcH4Epw=; b=daY6KNGuaLh7BzRfXpa4eZ8HzSekPiPie/3HoiQFWyX+DnaDKHiP8vZJ+Z4PFLN8Vt aS9fcDJwJgng4HjIMQ0MDcW9nSN3AewbztMnqZnI/2s37+VBHpmJSUE0dN90X4QMVXqe vPmPUkoxvH78VqQ1+IoGvsW55PSghv9UrldRZvUwFI5CDa4H2EwtqEx8iDEx99rpbrsh X5e142HiPbr2yCw92202/mpnMBdiFTM8zb9QpER9YaPFOVv2AFVOVFBngONRAPZisCtB QDK4MNOb3c9nACtTvg6hot6UMLsQpEBldgN67eRAdZM7WUYXAHAlA14cgshS7EYM5DyQ incw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706878853; x=1707483653; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=G2bY4vYtweXh8leJIICu6NBbyGqLWwvL3EkmAcH4Epw=; b=ebljHZEgIsCbE1Vh6uFPpXo7hcIwcO/GAnPMrJHc7FLa9P/YeANlqFHVkdaBKyUfvj iy1dU2Wnun4TmLrFS9u8XqlYW/XRtmLWE4WoPO2Puzp8ZPZFuw1Dnp70yYi8MRzsY0lG HANpJUPoKx/6VV/Jch2ySCSvbaVgmQ0y73Onkc1uQ3dUYXpYhScKkGOik1JXMxyuYmM1 kiGWzwCFCnCZIppKgwkcWeHRi5kdejfWcxGOQyOZHeRR0J5HGAU6touQ8Zoff8qRfMVj tdg7SauI8IcYjem2TZcsmHKZFdQyWwhG6hDowpbZQzkyWMAVZMJMk5Edw1zs5LwyxKeb UEvw== X-Gm-Message-State: AOJu0Yxwe68m53Tu07gHbkRf88ozHfqJ8uCAkZH309seoHwu40luOZS0 vjPI3Gcgey3O0afeCBNGwbymfgo5Y5CclmLmMLNq312RkhclG9vidvYDZRCqne4= X-Received: by 2002:a17:902:e54e:b0:1d9:55b:6a2f with SMTP id n14-20020a170902e54e00b001d9055b6a2fmr6469415plf.48.1706878852785; Fri, 02 Feb 2024 05:00:52 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCWj0I7Q3oG9lnP3Jthb1RGY+JzyyyC3B8DgwwQ1UmoAcVKTX29lKV5lAd2N1KGMWw+aHnhd/kOi4chN/v+bqpqjm1Y4UsXkCfix7LbaczNk5LsTSP4zhw4qbVY4l2jbsRuaw6OQrz0g+iXusaxYrLwMlU8rWlAbVZpzf3pMcJhXfsWeuwyClrLJf2csgSEOSQ== Received: from [10.255.208.99] ([139.177.225.251]) by smtp.gmail.com with ESMTPSA id mn16-20020a1709030a5000b001d9033b9d8csm1567243plb.59.2024.02.02.05.00.50 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 02 Feb 2024 05:00:52 -0800 (PST) Message-ID: Date: Fri, 2 Feb 2024 21:00:48 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 6/6] mm/zswap: zswap entry doesn't need refcount anymore Content-Language: en-US To: Yosry Ahmed Cc: Nhat Pham , Johannes Weiner , Andrew Morton , linux-kernel@vger.kernel.org, linux-mm@kvack.org References: <20240201-b4-zswap-invalidate-entry-v1-0-56ed496b6e55@bytedance.com> <20240201-b4-zswap-invalidate-entry-v1-6-56ed496b6e55@bytedance.com> From: Chengming Zhou In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 2024/2/2 09:11, Yosry Ahmed wrote: > On Thu, Feb 01, 2024 at 03:49:06PM +0000, Chengming Zhou wrote: >> Since we don't need to leave zswap entry on the zswap tree anymore, >> we should remove it from tree once we find it from the tree. >> >> Then after using it, we can directly free it, no concurrent path >> can find it from tree. Only the shrinker can see it from lru list, >> which will also double check under tree lock, so no race problem. >> >> So we don't need refcount in zswap entry anymore and don't need to >> take the spinlock for the second time to invalidate it. >> >> The side effect is that zswap_entry_free() maybe not happen in tree >> spinlock, but it's ok since nothing need to be protected by the lock. >> >> Signed-off-by: Chengming Zhou > > This looks like a great simplification, and a good motivation to only > support exclusive loads. Everything is more straightforward because > every tree lookup implies a removal and exclusive ownership. Right, much simpler! > > Let's see if removing support for non-exclusive loads is agreeable first > though :) Ok, I have just posted some testing data for discussion. Thanks.