Received: by 2002:ab2:710b:0:b0:1ef:a325:1205 with SMTP id z11csp841783lql; Mon, 11 Mar 2024 21:56:53 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWdniFd7JpFhmMkIeRDZPLzMruhWuBshbSfMJhPXJBzQ41AIUFlMhCspe7IHZ9+6ssKQXiRikvNP8cswHaxsJZ3SLNEZNWQqnXCRZiheQ== X-Google-Smtp-Source: AGHT+IFoujM3mnGjJS3WaKCYaOMKoVX6zGVgZoXsNV7XxEXzA8kg8jC8lZe9lC88efM0J/dIBana X-Received: by 2002:ac8:5748:0:b0:42f:24bb:dbae with SMTP id 8-20020ac85748000000b0042f24bbdbaemr11592548qtx.37.1710219413298; Mon, 11 Mar 2024 21:56:53 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710219413; cv=pass; d=google.com; s=arc-20160816; b=ynYzZpTQoKWc5s/Q0ZBKIcgr/JFF3VHQa+QrlhwZv4qESMn/i+ac2JRpcVV/kElEwM 5CC6OZkLlnYOOc2MmCQP4UVCVlUR/UfYyLzAlCokQZBGcSZ9hhaZYg1bVXMknhA9mM6d sQLEDRL8TlgRek2X/TA08gjLkBTSRwXo5BWs5LcKf29SXc2Jg4TRP7YzIBJk7tRLAyAk hF2jXIsdsZ+Ass/lDOYP7BKlpi6KMmrPYKrzGEA7Zf3noSY7eMOUDND1bjUulc0/gtLa 9vukoaQHG8gF88+Iy5JBW/UXaNS3nWnMDkRmizEw81uEU8dDQBQ+Sr3an+r8L+tt/uvq mECA== 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:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:dkim-signature:message-id; bh=ZjdG0PtOxjtchDedrvDz9Mya7+ckepXI9cgYn3cZEtQ=; fh=E6Ii7o1jouIWYOszFjxbx5Fx6F8DjGdVnlmUIkyoz3c=; b=LzDOCk481Pryi3Reyu3f/AInLaw6/cSRyQ6cjBBk0+XJzK28w9xoVUZa5rEiBr15hd H3XYCbzBQiY1UglYaL1AyD6eufDIAROTlchk3Kdg8w5MxwNu8Qcw7FT5RcSLzAgRkePP 71WR9TLjwIYFbVkGmz3yx5rYhqlXjR8Nnly25WWM8c76qrgKKnXuX9XmrnYoimcS9pnm 2MauuWpk05FMb/0sCP0sJe5Lr5V0Wyqff+PYNTbDBdOhCpyZWqWt+TNcSjG8E5Y/BTju Oz5bBYIvHX93Y6froTql9otf18eJOCOrSWJ/xIafKipqLOHM1Idmf2BVWTSvUf2BaxUq Q70g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b="wrx7O/+3"; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-99832-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-99832-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id v23-20020a05622a189700b0042edef649bdsi6965142qtc.133.2024.03.11.21.56.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Mar 2024 21:56:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-99832-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=@linux.dev header.s=key1 header.b="wrx7O/+3"; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-99832-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-99832-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev 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 0B3571C214FA for ; Tue, 12 Mar 2024 04:56:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 64FF63FE51; Tue, 12 Mar 2024 04:56:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="wrx7O/+3" Received: from out-182.mta1.migadu.com (out-182.mta1.migadu.com [95.215.58.182]) (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 83B5C3FB81 for ; Tue, 12 Mar 2024 04:56:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.182 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710219407; cv=none; b=ue23+A3NqiOYfJ+f1/PfNtvTs62OhMWYRLVRvPev/+Cm/Rs24eEYtM39UX7j9PHLwTPUfH+cZwJqcYe33y3XP/pqce1MrKJZ5Hv4bYrMCprEDsZ/IqQ0iQq+6oUzuIcFauFouJqbc16rRaplwdnZLRJa7wJ01VSvZUxajpq+vsQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710219407; c=relaxed/simple; bh=mzgU+nStrjJoWqCQO1AwyeENQKZDP1kBTG++YrAOUM4=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=dUouEF/zBqBUFmMV53zAhBhOJyb1UeoZZjsunXku28AoY56T3ySNDlmlafoxqg96uacH+thUYKteebALWRxaCLRqxhguySKXTCWffGJt6Qsytepm79ZWdt8xzAIWTXnXVQLpKR3WpSG9xk6U6hQ66U626ziHSC05yWEhzrduC8E= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=wrx7O/+3; arc=none smtp.client-ip=95.215.58.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Message-ID: <02886208-06df-4370-b0a1-6295b654bea2@linux.dev> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1710219403; 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=ZjdG0PtOxjtchDedrvDz9Mya7+ckepXI9cgYn3cZEtQ=; b=wrx7O/+3WGmpKxjSrJwL+tAIQeQh6DYEDgz6mr0ByLRlBUOlyx5q6AStc4k4GmkhLyHl78 QJoKuwN9FwpP4mPTaxP91IFqdYcTuBMT9T25nLm2RFIsO0Iu8bwAJGnvCFn7A5MMaK744X 0ykcakWwMcBNE4XbzmV84x5Z1rtlEHk= Date: Tue, 12 Mar 2024 12:56:35 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [PATCH 2/2] mm: zpool: return pool size in pages Content-Language: en-US To: Johannes Weiner , Andrew Morton Cc: Yosry Ahmed , Nhat Pham , Chengming Zhou , linux-mm@kvack.org, linux-kernel@vger.kernel.org References: <20240311161214.1145168-1-hannes@cmpxchg.org> <20240311161214.1145168-2-hannes@cmpxchg.org> X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Chengming Zhou In-Reply-To: <20240311161214.1145168-2-hannes@cmpxchg.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_OUT On 2024/3/12 00:12, Johannes Weiner wrote: > All zswap backends track their pool sizes in pages. Currently they > multiply by PAGE_SIZE for zswap, only for zswap to divide again in > order to do limit math. Report pages directly. > > Signed-off-by: Johannes Weiner With the incremental diff, feel free to add: Reviewed-by: Chengming Zhou Thanks. > --- > mm/z3fold.c | 2 +- > mm/zbud.c | 2 +- > mm/zpool.c | 4 ++-- > mm/zsmalloc.c | 2 +- > mm/zswap.c | 4 ++-- > 5 files changed, 7 insertions(+), 7 deletions(-) > > diff --git a/mm/z3fold.c b/mm/z3fold.c > index 7ab05621052d..9bacacd4168c 100644 > --- a/mm/z3fold.c > +++ b/mm/z3fold.c > @@ -1404,7 +1404,7 @@ static void z3fold_zpool_unmap(void *pool, unsigned long handle) > > static u64 z3fold_zpool_total_size(void *pool) > { > - return z3fold_get_pool_size(pool) * PAGE_SIZE; > + return z3fold_get_pool_size(pool); > } > > static struct zpool_driver z3fold_zpool_driver = { > diff --git a/mm/zbud.c b/mm/zbud.c > index 2190cc1f37b3..b7d8a22bbf5f 100644 > --- a/mm/zbud.c > +++ b/mm/zbud.c > @@ -412,7 +412,7 @@ static void zbud_zpool_unmap(void *pool, unsigned long handle) > > static u64 zbud_zpool_total_size(void *pool) > { > - return zbud_get_pool_size(pool) * PAGE_SIZE; > + return zbud_get_pool_size(pool); > } > > static struct zpool_driver zbud_zpool_driver = { > diff --git a/mm/zpool.c b/mm/zpool.c > index 846410479c2f..410808aee7fe 100644 > --- a/mm/zpool.c > +++ b/mm/zpool.c > @@ -324,9 +324,9 @@ void zpool_unmap_handle(struct zpool *zpool, unsigned long handle) > * zpool_get_total_size() - The total size of the pool > * @zpool: The zpool to check > * > - * This returns the total size in bytes of the pool. > + * This returns the total size in pages of the pool. > * > - * Returns: Total size of the zpool in bytes. > + * Returns: Total size of the zpool in pages. > */ > u64 zpool_get_total_size(struct zpool *zpool) > { > diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c > index 7d7cb3eaabe0..398f3856817f 100644 > --- a/mm/zsmalloc.c > +++ b/mm/zsmalloc.c > @@ -401,7 +401,7 @@ static void zs_zpool_unmap(void *pool, unsigned long handle) > > static u64 zs_zpool_total_size(void *pool) > { > - return zs_get_total_pages(pool) << PAGE_SHIFT; > + return zs_get_total_pages(pool); > } > > static struct zpool_driver zs_zpool_driver = { > diff --git a/mm/zswap.c b/mm/zswap.c > index 7c39327a7cc2..fe4343e416e0 100644 > --- a/mm/zswap.c > +++ b/mm/zswap.c > @@ -507,7 +507,7 @@ static unsigned long zswap_max_pages(void) > unsigned long zswap_total_pages(void) > { > struct zswap_pool *pool; > - u64 total = 0; > + unsigned long total = 0; > > rcu_read_lock(); > list_for_each_entry_rcu(pool, &zswap_pools, list) { > @@ -518,7 +518,7 @@ unsigned long zswap_total_pages(void) > } > rcu_read_unlock(); > > - return total >> PAGE_SHIFT; > + return total; > } > > /*********************************