From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8407FC36008 for ; Sat, 29 Mar 2025 19:53:32 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 423F828017F; Sat, 29 Mar 2025 15:53:30 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3ACF628017D; Sat, 29 Mar 2025 15:53:30 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2503728017F; Sat, 29 Mar 2025 15:53:30 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id F3BB728017D for ; Sat, 29 Mar 2025 15:53:29 -0400 (EDT) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id A402BC1A86 for ; Sat, 29 Mar 2025 19:53:30 +0000 (UTC) X-FDA: 83275638180.17.45DFB9F Received: from out-180.mta0.migadu.com (out-180.mta0.migadu.com [91.218.175.180]) by imf14.hostedemail.com (Postfix) with ESMTP id 9FCE910000A for ; Sat, 29 Mar 2025 19:53:28 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=FrJTbrqS; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf14.hostedemail.com: domain of yosry.ahmed@linux.dev designates 91.218.175.180 as permitted sender) smtp.mailfrom=yosry.ahmed@linux.dev ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1743278009; a=rsa-sha256; cv=none; b=zNGP60mcOQm1wqVJxcxPWKbivhr42JqpR1ENr3hj30hbs+vN+rEYBCo0AXBhlgGoiB6ObP jZKUvRNg307hOzcYZTAV5F/xACs6fOTYHYlZ9jbInCqVgsrBHKt4YrESCiC2KXY/0ES5Y5 W3+dhHSL0PGzPHAHpoQgEHatu+A1moA= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=FrJTbrqS; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf14.hostedemail.com: domain of yosry.ahmed@linux.dev designates 91.218.175.180 as permitted sender) smtp.mailfrom=yosry.ahmed@linux.dev ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1743278009; h=from:from:sender: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:dkim-signature; bh=ME1fBO5Jh7xEa67T+MF0kiPosGpY29d6ns5G/AbMfrI=; b=t5nQw5LDY85zB2ERBtrR4wrNPwhOVbxUXCWKAntT9b57HT7s+gTtjw+ys6tGO8xcUHFG6Z swVoCMYIf5w5vo8cK1xldXaV1OQg26EmWshGtvhiTMCM+/6ppkEd+6N1+Ru+4wVj4CAS8a 0CQJfU+/1TCWCzhKwzFrotuVm9lKWIo= MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1743278006; 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=ME1fBO5Jh7xEa67T+MF0kiPosGpY29d6ns5G/AbMfrI=; b=FrJTbrqSP9wgn9WjYsD4xZr35TJFbcMCIw0hf+C5ZLFqizCcYh4WdAYysMmoHk98J9BlgW 1ny8mVqF0OJgZx0+W6FirtSrUVwyquaoI/feHaQRZxijkeSHntDcokRVrfzRIiFRW9wKKn /yoj2JdXBr143TT+1OLPY4DAsbZO4d4= Date: Sat, 29 Mar 2025 19:53:23 +0000 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: "Yosry Ahmed" Message-ID: <2759fa95d0071f3c5e33a9c6369f0d0bcecd76b7@linux.dev> TLS-Required: No Subject: Re: [RFC PATCH 0/2] zswap: fix placement inversion in memory tiering systems To: "Nhat Pham" , linux-mm@kvack.org Cc: akpm@linux-foundation.org, hannes@cmpxchg.org, chengming.zhou@linux.dev, sj@kernel.org, kernel-team@meta.com, linux-kernel@vger.kernel.org, gourry@gourry.net, willy@infradead.org, ying.huang@linux.alibaba.com, jonathan.cameron@huawei.com, dan.j.williams@intel.com, linux-cxl@vger.kernel.org, minchan@kernel.org, senozhatsky@chromium.org In-Reply-To: <20250329110230.2459730-1-nphamcs@gmail.com> References: <20250329110230.2459730-1-nphamcs@gmail.com> X-Migadu-Flow: FLOW_OUT X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 9FCE910000A X-Stat-Signature: q1p5yaj3qic7xycg7gzx7r4nqfs5ypcg X-Rspam-User: X-HE-Tag: 1743278008-240872 X-HE-Meta: U2FsdGVkX18Htdfkdg7rQ0LjGKKRxyya6buzV8i4LJq4ixWERxfggemAY4Xmgl572nBfjIFaldxJ+QN4lVGl0/OvgJDJaeF4hJZaqbjxjLA9BOmFjogk9Fx0R7g2FLCLmUeMM9VSWtta9wA3ksNPWDHIi1bFlURPz4Ets7NnWGA9LCS1MnG/XnNUooB0Y695lqpcNbs9NcEiIO+jO/J+Mx1GWWsWzOpvDsIybg3pqjRy5vPaeppSalOEC6bIL2/CQD1JWlaYGRCy1rxqT3W1XKE7mAlo898vt9B58UoAYWUBh6Be8cSRFZVjcWOnI/Y3bMgB3b1M/f0ENdvMTmDD20imfF/X/FrmCrykJq7eVnusZhcTjzZ5hQOpByuQvDMwYICIecY+c+D7pptE/OQe7BgvCwy6US2wzWmF8k/+onQ6anb2W07DtwxbTkTjbrn/TDZEMsTpcLsGsY0wU+gjWT1scRRaFAg9eRNUzlVS8ccdG+DSKtt5ONnBawBxIIXzRvBogEuoe+9qyPPFe3OYvLQdUF/bsCvQG+rPh5TXdSPukFTkDI+YVYu7GSschNzA8J8ICfuIplhxB1bfwLgOuJg87jGVUFOgCrVjBJbpjbs0ZNkuDWTxS6YUjw2GrfqTnY3GZkqZ7ZkosAoraNfH8m5LqBNapDHiVOOuLUwuLGpHfaIwbuv5xhI4n7rYcatnQj0e47EwhVSJJHAE7W8CYvpVLdT55Br5DKYDioDhnecFIpBraefbAQZRg61Rrj3bql96cdDIAFDEcFWqzouIyoVyS4f//fxlYxMKZCmZwRfGK7KK4vnjAPLymkftub7tGlxRve5BusCdaUCnlpLhgonHcc+29DL7ikkzn4mR9tig9J7O0Op8D3cypNSXakSxT9VSw7CPn3WgNo2EWv4kTpZl1P6B7BCoEaqtV3Cv1cA7wy+HlXkj2CgvQHzXWJPNHptn+KBJMT8DKxEiiVZ nlM+4WP4 K+8Q9P4mvjM98dbnIKn8iNN+MopVlZ3u9dVrpdrREyqAnv/Jw6nHKESqkMytwX0gcPrsn7Jr7JjEHsZch56q1xohyEaj839mec7Cqfl1RcUqqSMjaptuP9ThZGVJQaKPN/rzEYC4Y9ORKxZqeX9Qk212nmdmu46oFhrPFAxL6WAbYiXl4Uykd7+n9LsCQ7w9YnFLn119727cnbhyiW5uAsQjgTw== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000023, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: March 29, 2025 at 1:02 PM, "Nhat Pham" wrote: > Currently, systems with CXL-based memory tiering can encounter the > following inversion with zswap: the coldest pages demoted to the CXL > tier can return to the high tier when they are zswapped out, > creating memory pressure on the high tier. > This happens because zsmalloc, zswap's backend memory allocator, does > not enforce any memory policy. If the task reclaiming memory follows > the local-first policy for example, the memory requested for zswap can > be served by the upper tier, leading to the aformentioned inversion. > This RFC fixes this inversion by adding a new memory allocation mode > for zswap (exposed through a zswap sysfs knob), intended for > hosts with CXL, where the memory for the compressed object is requested > preferentially from the same node that the original page resides on. I didn't look too closely, but why not just prefer the same node by defau= lt? Why is a knob needed? Or maybe if there's a way to tell the "tier" of the node we can prefer to= allocate from the same "tier"?