From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ot1-f50.google.com (mail-ot1-f50.google.com [209.85.210.50]) (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 651A73D2FEC for ; Wed, 4 Mar 2026 18:03:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.50 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772647400; cv=none; b=A/07Bt5mHZRVOktbxT9+m40GX/3uErMyAQTvEAVb+LbSybUz86WEQQOVJNCp3kLB7b5XZWkwO18YciHGwSCG8NAN1EmkMvd9itMKiJ+zDJaMlVt3A+lInc1OX8EMIiNg/LpuYVKr60w1Hc8iwkKjEvdlCwggNV3QJm4TbT6fnbc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772647400; c=relaxed/simple; bh=b3z2Q6w2vfKhXsc40dBWP44/TifLR8eOYPiKu5rSkjM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=IFU4hHdTNWveeHy8Eqc7ZKsf5TS0oyGaVaRqZZTnE74Dyr7RtN9yUzdaG6TkqjVSeaAMxrZrswFwlVd9fzW0yTINngy13nW5lnERzkYimsSxx7aFU1MrOxKfUUwK1mN+3+TB6F4i2Lk2MFl8o63ORYJFu3CTVzGbiGPhg5KQCpc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=XVAzsvot; arc=none smtp.client-ip=209.85.210.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="XVAzsvot" Received: by mail-ot1-f50.google.com with SMTP id 46e09a7af769-7d18d02af68so5649802a34.2 for ; Wed, 04 Mar 2026 10:03:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1772647398; x=1773252198; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=s081Yqcw4FMldRcUhZ32fBADnqVG0rTSkc+UZ7N5S5M=; b=XVAzsvotUfvQOZn3lxZRpH1uFmYnkjKjKZBwn66eMnCZ26Ie9zEYnkMUgIv7IJQ1bD cE5T/wI5RtK5teDTi8AkYWjoD5wdMrZOMrgiFmoHrR1u3/gDYy9us7JKH8/V6dMNut5t s0bFX016WUn0UU2kXSUt4sn9Oeor+VHkan6Rt7mNTNAyFPKYPxq/NNacAuhwuWNFDeLR OVHcXUoTDWmF7+UHgelIT1dDXJzFsdxGU176qMaJxfUQCNpE0Pbn4TYGevG3UX78cTiU TZtqMug8psnp3Ka9zON9tCnqkeQo5K5cv1xM/GuG60zrxRzZVpvZvGfpe+0NAGfK+5RN tewg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772647398; x=1773252198; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=s081Yqcw4FMldRcUhZ32fBADnqVG0rTSkc+UZ7N5S5M=; b=Y2A5JHHSUduCkZs9SCgFdcY4Rj60zFrIzau99qvtZmjPvp96ZrRehycwpUTpOfr8Xk 5acsO9iDPZtN11X9gU74/jgkh/0GP6A4j7o22yD9eshNT9qTr4CziUVWU/plBn3L658B ErITCrXtBybEIWfUVG3rfoLIfFqAIQOr4nEcNsYUn9m37xVodCvs3Zmxzv6jfdGfM8/u KiqUbdv4a2SN5HazzFvjp2H/ww8o7mV3/km+Ns0kPNDswJ9mBgeBfbjMSpMGlLiHZd5c hXn/8wHUHHriEOrTzBkaTkvlOByvxTF13t6p/ID7Nkte87kZwgAjwdaAym6qmy65OqaO oNHQ== X-Forwarded-Encrypted: i=1; AJvYcCXNKNlsnaSM1k3+PDDwp5Wv4J0wLhMgkYJmJt23pGbc/4Tr7UB3v582DPi/rYMt4MdOMdC2T1HzWbhDs0o=@vger.kernel.org X-Gm-Message-State: AOJu0Yyhsnf5A1QWwX0baOlfWzz7dKpaHvq11EuiIZ8xkrhkvZZGIEIv vYp/Q6l+Q1ampuHHzuLPG5nW7KkL57yso3dmcsfaVgKmxizxZB23N3FFqIQzQw== X-Gm-Gg: ATEYQzyqRKnJwXGcJwELrlvvZNHL+j05KIfU8CL07pmSiAabYO7YFb+Xj3jGYGd+Js7 oT/1GjpGJGvQ7s0MKTXNO59jZwdXTRTjaby8GYwaK9kXhjEfSAze9iTkbSXztq+j4xPqPoK/mAQ hKctlSP1gBAu3zSDve5WFWGrmFOAMZV8e5Nt/cFx8dTXlPZUj1Ac9KXhSKi4/6pM+R1kFmlho2j xqkkhkJzwkdhZwudkcC58lkMBFFUG8n/+nEXHUt6ukcDDh9PPN5htc4I4o0myKoTX6IiMfh3xDy SX8oWC5Q/sIHOZVG9jHb72yVzzTIG+UuhrtzEhkVi9qemJvT/65w8RUPG82y//iaGA24I5ZmNYu eaDKaTnCDrncV9lFdvRF7smBEbWFjLHfFzqlVPuP+5wFzaG0Um38gH9vdHAqxI3k8oYmpBTe01N Kq1cro359ly4nM3/mh1TlN X-Received: by 2002:a05:6830:264e:b0:7cf:dca3:5c6f with SMTP id 46e09a7af769-7d6c7f5e661mr1785549a34.16.1772647398349; Wed, 04 Mar 2026 10:03:18 -0800 (PST) Received: from localhost ([2a03:2880:10ff:c::]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-7d58644edfbsm15582806a34.6.2026.03.04.10.03.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Mar 2026 10:03:17 -0800 (PST) From: Joshua Hahn To: Yosry Ahmed Cc: Minchan Kim , Sergey Senozhatsky , Johannes Weiner , Jens Axboe , Yosry Ahmed , Nhat Pham , Nhat Pham , Chengming Zhou , Andrew Morton , linux-mm@kvack.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@meta.com Subject: Re: [PATCH 3/8] mm/zsmalloc: Introduce objcgs pointer in struct zpdesc Date: Wed, 4 Mar 2026 10:03:16 -0800 Message-ID: <20260304180316.1429892-1-joshua.hahnjy@gmail.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit On Wed, 4 Mar 2026 08:58:44 -0800 Yosry Ahmed wrote: > > static struct zspage *find_get_zspage(struct size_class *class) > > @@ -1289,13 +1336,14 @@ static unsigned long obj_malloc(struct zs_pool *pool, > > * @size: size of block to allocate > > * @gfp: gfp flags when allocating object > > * @nid: The preferred node id to allocate new zspage (if needed) > > + * @objcg: Whether the zspage should track per-object memory charging. > > * > > * On success, handle to the allocated object is returned, > > * otherwise an ERR_PTR(). > > * Allocation requests with size > ZS_MAX_ALLOC_SIZE will fail. > > */ > > unsigned long zs_malloc(struct zs_pool *pool, size_t size, gfp_t gfp, > > - const int nid) > > + const int nid, bool objcg) > > Instead of passing in a boolean here, what if we make it a pool > parameter at creation time? I don't foresee I use case where some > objects are charged and some aren't. This avoids needing to always > pass objcg=true (for zswap) or objcg=false (for zram), and reduces > churn. Also, it allows us to add assertions to zs_obj_write() (and > elsewhere if needed) that an objcg is passed in when the pool should > be charged. Hi Yosry, Thank you for another great idea! Makes sense to me, then I can leave most of the existing ABI signatures alone and just make the zpool changes. Thanks a lot again : -) Joshua > We can even add a zs_obj_write_objcg() variant that takes in an objcg, > and keep the current one as-is. Both would internally call a helper > that takes in an objcg, but that would further minimize churn to zram. > Not sure if that's worth it though. Sergey, WDYT?