From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qk1-f170.google.com (mail-qk1-f170.google.com [209.85.222.170]) (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 63CE623AB88 for ; Tue, 25 Nov 2025 21:31:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.170 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764106297; cv=none; b=WtXHcJjfJaphKTz5HMVV9Z9xAEca46f3ZK8O1UhSJlKGoeUegHlaXKVw1X9IbkpFRuzIvJt57voFmqkdqsgfbuMaKvUTkO+PWBCzu7Nf8oL1eevLQDodVH48tVzjrcPfTxDJzZwxaoRvlMyTBgmXkSrklDtbmOh7N4BA7G/av1E= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764106297; c=relaxed/simple; bh=vzfP/BIVGmuokGnpfmSdl5cFv8OQhDOY9cAikU+yyZU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=jpkhmxvFMitr5GA9+Fi0jAE+2xqQRBbLeLJ6ZaKxrrfgYK3PiVZOLDaltEPuLNxA+KYFK0TYn14Rn0k66BUseZwbQWO38eO2a/XSokJrJk+aRUGSpj7poVMAWPzcAukXit9zRSopVfzh75y2Nt0Vcrrk86SXFQvw1PuIoQ6h830= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=cmpxchg.org; spf=pass smtp.mailfrom=cmpxchg.org; dkim=pass (2048-bit key) header.d=cmpxchg.org header.i=@cmpxchg.org header.b=d7cM+KJ+; arc=none smtp.client-ip=209.85.222.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=cmpxchg.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=cmpxchg.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=cmpxchg.org header.i=@cmpxchg.org header.b="d7cM+KJ+" Received: by mail-qk1-f170.google.com with SMTP id af79cd13be357-8b2d6df99c5so27502285a.1 for ; Tue, 25 Nov 2025 13:31:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg.org; s=google; t=1764106294; x=1764711094; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=lRUHdC1aRlmDgOnI/JdXNf4e5VYwEVqBwWqeAqYvNgA=; b=d7cM+KJ+H4n36Yt1+GQJqthG7tKqJuYb7w1W+VwfflvU3xRzjmbGJIHv7cLmU/V4QE n6jLkufRCSeZyzKdKCE+FxCfH/xgEyESsyzqPSYL0vvepTv01Z6H6c0n8njt1mlUNc1O Pb0Eiv9qdUDI9AvgXKb+dT3QnV62fjgCrdyd5XywsgBeMfJGF/a1SGQXFBijKABZ+JdM JDWPuqb2ReHA2ONd9/Z64eCShGsXcXA631X0tszpik8AX6wlCygZ2HhL3iCFPBCavIgZ TbZ4/kI6lZNFE3BSooOympL0YXWkWd55/HGVtl33Jr+WKM5qsGYdvhhQflc6tNjhpzSn sSjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764106294; x=1764711094; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=lRUHdC1aRlmDgOnI/JdXNf4e5VYwEVqBwWqeAqYvNgA=; b=gLA+5UPPsU0fFRs4PXPRjbkiAxGDO/yrR+OahG5UAFhkmzGjTUK6jOVq5dSOzStHQr ylY85gNb54eg/gSLVXKqENU9f25m/xbXgDkNJW99mo5ZCdbkiznAAGfuvKiYBRWjxWv6 dxn4vrVJmUwOLfxpC1LxZ8hVPCjvID4lAWwxOUCO8g35VvZF2XmbnFqrAKJwmZVsZ19M hFTPj/ESkcenDOwwKJLYgaz5hUs0S+kZ75ZmtmuQW+QvGECLcnCtXw2P20p55oupsOKV cTfgVgnrfPcsTobKm7C090lzOP6KF5fnZ+3Vu2jgGb5zB3QdA/cE9yse3B1dfkzaD1gC nOnw== X-Forwarded-Encrypted: i=1; AJvYcCVn1cRpNkXHItkbO5AxweHkjP/IINd5uPuMrRyaWV07xxa2U6GyWDwSFiyY294NHPEyMqrAfzdZTPYcE6E=@vger.kernel.org X-Gm-Message-State: AOJu0Yw6YhPVz7/hTypHdrbxIGIe+pCNm/HGr6lJv2Kkjt4AyDAA4ssM AMXq5eSsStUWdHf3LCLGsnXMwnkY3mZQxMzBlmd+dgqUfaV62iWWonJLHH6L3cqJA84= X-Gm-Gg: ASbGnct8Niq2Il+9JGK1/KKIZY37VuT8WApZ7DvUfY9WksB0mOkfJmrJzUOuyTFmZwD Xu5WoZ9Kq8hBRrnXY2l+KKegAmS2CrdG+em53qpN0+he1uE3h1fF9kG5rkrmg7c91i4SM6ioH+l Vixr4eVQZW3BSAlIrHpbt8wp2DTxrzwufecJCe3PkDMqaukESKBx4JRueqpbjD/8/EJ8xA6/yF0 P8di2B2XE+l4z6aPHdOyewtedOt3jwD0TWxboxV1hvQkkhqCg/DkeWJ8+H7wlJGVDgayiR/9EJl UhGRIugejtgK4tbS/sngE925AQVd0eBSdscGKU24Ggq8BtKGgEPXlBN12yDHKvMKlddt/GK6lK+ tOeZeW/Fc7wV7SetxRdF/6ywyai50Ud3HdwOiy/4NtLWRt7OjPhhQKRBxuqGpiOafc/jiou41h0 0Oy5b3R1fDqQ== X-Google-Smtp-Source: AGHT+IESFDhYjWwPyHUj5ojId09JBhGC/7vdROiobNKajXEcUJDzyX88Qm6INxXjo9NZYRx2Stetzg== X-Received: by 2002:a05:620a:2943:b0:8b2:9b48:605e with SMTP id af79cd13be357-8b32af2fdf4mr2704623985a.38.1764106291386; Tue, 25 Nov 2025 13:31:31 -0800 (PST) Received: from localhost ([2603:7000:c01:2716:365a:60ff:fe62:ff29]) by smtp.gmail.com with ESMTPSA id af79cd13be357-8b3294321dcsm1234154185a.13.2025.11.25.13.31.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Nov 2025 13:31:30 -0800 (PST) Date: Tue, 25 Nov 2025 16:31:26 -0500 From: Johannes Weiner To: Chris Li Cc: Andrew Morton , Kairui Song , Kemeng Shi , Nhat Pham , Baoquan He , Barry Song , Yosry Ahmed , Chengming Zhou , linux-mm@kvack.org, linux-kernel@vger.kernel.org, pratmal@google.com, sweettea@google.com, gthelen@google.com, weixugc@google.com Subject: Re: [PATCH RFC] mm: ghost swapfile support for zswap Message-ID: <20251125213126.GB135004@cmpxchg.org> References: <20251121-ghost-v1-1-cfc0efcf3855@kernel.org> <20251121114011.GA71307@cmpxchg.org> <20251124172717.GA476776@cmpxchg.org> <20251124193258.GB476776@cmpxchg.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: On Tue, Nov 25, 2025 at 11:27:04PM +0400, Chris Li wrote: > On Mon, Nov 24, 2025 at 11:33 PM Johannes Weiner wrote: > > > > Do you have a link to that proposal? > > > > > > My 2024 LSF swap pony talk already has a mechanism to redirect page > > > cache swap entries to different physical locations. > > > That can also work for redirecting swap entries in different swapfiles. > > > > > > https://lore.kernel.org/linux-mm/CANeU7QnPsTouKxdK2QO8Opho6dh1qMGTox2e5kFOV8jKoEJwig@mail.gmail.com/ > > > > I looked through your slides and the LWN article, but it's very hard > > for me to find answers to my questions in there. > > Naturally, the slide is only intended to cover what is in the current > swap table may be phase VII. > But it does have the physical location pointer consideration. > > > In your proposal, let's say you have a swp_entry_t in the page > > table. What does it describe, and what are the data structures to get > > from this key to user data in the following scenarios: > > Please keep in mind that I don't have every detail design laid out. I > follow the first principles that redirect a swap entry page should > only take an additional 4 byte per swap entry. VS blow up the swap > entry size by something like 24 bytes? Nhat can lay this out in more detail, but there isn't much new stuff in the virtual swap descriptor. It's mostly just a consolidation of state we currently track elsewhere - swap count, swapcache pointer, cgroup ownership etc. The actual indirection is just a word for the backend type,offset. That indirection is the tradeoff for swapped pages. In turn you're getting back all that other stuff for swap slots that *aren't* currently used. This is a win for the vast majority of users. Since you mentioned first principles - the dynamically sized swap space is also much more suitable for compressed pools, which are the dominant form of swap setups nowadays. Again a win for the majority. And the worst-case is reasonable. I don't see the giant gulf you seem to see there. I don't know where it's supposed to be coming from.