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 1CC12CF6493 for ; Sat, 28 Sep 2024 04:51:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A762E6B0188; Sat, 28 Sep 2024 00:51:06 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A24C06B0189; Sat, 28 Sep 2024 00:51:06 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 914446B018A; Sat, 28 Sep 2024 00:51:06 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 797626B0188 for ; Sat, 28 Sep 2024 00:51:06 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id E9EDD80F9C for ; Sat, 28 Sep 2024 04:51:05 +0000 (UTC) X-FDA: 82612922490.01.CEA63FE Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf04.hostedemail.com (Postfix) with ESMTP id F074D40004 for ; Sat, 28 Sep 2024 04:51:03 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b="A/Tb5/cf"; dmarc=none; spf=none (imf04.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1727498928; 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=SWosS3jl6trCdAKJuZfWE5QOA2qArqoNUePynF1px8o=; b=59du4lDtId2M3bOE+jgXir6cD/r6PW9tYsOKV+K5eauN1zvXB7StanvKb3/o2pUOg9Dnk3 ySJK4d7jCKdamsVpOpaIz6X4jJv8ZDB7tdDw38QdV0rVPVDiAzp3f3wJ3TD5nktQbPwWkw eN3m++u6jYzVvL7hETIFCo8CKXtg1zo= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1727498928; a=rsa-sha256; cv=none; b=fcao/gbnkneQDUF9bAnpqoGecF8n314wCPF111bz73WZvCY0ueS2c2wj+QQbmEhol1+Sab pDgZWndQYIGvxIaFUJX9gBhmJVzgRaJpqlv87gJUEC6XIr+QfadZy1lb3i9HZ6a+GYf/TF h42BNAgqwokHqlXX+ohDhTDmgYnKkfk= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b="A/Tb5/cf"; dmarc=none; spf=none (imf04.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Transfer-Encoding: Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Sender:Reply-To:Content-ID:Content-Description; bh=SWosS3jl6trCdAKJuZfWE5QOA2qArqoNUePynF1px8o=; b=A/Tb5/cfs5SOYAcs9otvzgfLQL jQXxisSnET+Vb4GFBlp5AU7bKcuy8oKLJ5Dnzo5rD99vVCdrYaAjNCD/LdhOBsyKvpdjnHnjpPklI 4Bg2+zNB82wnVu8ugEvkfJkC7uCT43JoEdGzuFd6dLD7LKyOVqZ5p7Owc+CZzAXU+2KeE2av6qoTc t2e3VALxvDWXTFRJxoDvlbjtaCi/Y02Qf6MpgyOl5gGPDq4GMdxOUrUMuvUD83Vg+daSfNWjo11SN vfHvOtwd25vfLlegCwB9GG/gDWR9t7z48DenUtMLBHqhclYZd41WMQiDptPQdRd6o5ND+ifLtgm8M JG+IDnrA==; Received: from willy by casper.infradead.org with local (Exim 4.98 #2 (Red Hat Linux)) id 1suPQ3-0000000BTN5-23aY; Sat, 28 Sep 2024 04:50:59 +0000 Date: Sat, 28 Sep 2024 05:50:59 +0100 From: Matthew Wilcox To: Yosry Ahmed Cc: Kanchana P Sridhar , linux-kernel@vger.kernel.org, linux-mm@kvack.org, hannes@cmpxchg.org, nphamcs@gmail.com, chengming.zhou@linux.dev, usamaarif642@gmail.com, shakeel.butt@linux.dev, ryan.roberts@arm.com, ying.huang@intel.com, 21cnbao@gmail.com, akpm@linux-foundation.org, nanhai.zou@intel.com, wajdi.k.feghali@intel.com, vinodh.gopal@intel.com Subject: Re: [PATCH v8 5/8] mm: zswap: Modify zswap_stored_pages to be atomic_long_t. Message-ID: References: <20240928021620.8369-1-kanchana.p.sridhar@intel.com> <20240928021620.8369-6-kanchana.p.sridhar@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: F074D40004 X-Stat-Signature: 4ckwz74mmwb5e4hwxrmdizdapf5okcdz X-Rspam-User: X-HE-Tag: 1727499063-155405 X-HE-Meta: U2FsdGVkX19iwL4JfRGH2iQQss//Y9J0hFglfCFOWO2mhak03jJto39uBs0Xb4e8KD0dHYODDFybI/8rrODdTlbYoSgj0F6+VI4NWbEVJpkJ9Q34V/hkaTv3vATexfuKbRnY6UQtt7xznujfA/nNAnx2FFf21b9OKHQZL5WDX57ySrOaBcUIMhTvoTmB+GwcWN0ENxjIMzlVVv2mAqC+YLm8CkAeDBCgd39MZlTjD/BK6Zr3YDWDb970vf8IKyPxk2Ebs7SxP7ARcJB296cwSWaoe8pDIDZLI1kiulkGosEK9r0s6Il61KwRxWdotNmq+QypeKykiXBLdy26lQkjTv8z5OGbLP5T2UU27ydUotGbSsiuSBIQ8N6qJwEypTjFOLY5wpJQpSJBqy3vpnhWn5AlAlzYDSKp4kDiS1D+DvbW9PcG8NJEQYYWq9vdQjVGUPj0c/ad4bxlHahDKPSzGWa2BUJoQNmGxstTFMkcN0toi4+EtyDfy6BzTDiZyg0TTKbgT1QQHCkcZubpo3LGnBrZxKN66p52N3f5oMiySftIlL1uzyhsN/MgEggadN1Qx2SLWOFDGfFguAL6FbHFtFmY2eH4hgSLtzEvMNFyQzGd6BO6P/RQEk8rO/hR8jRNiZFhQrtX2hxnrGUcWT7Pn9F2p3FBtgM2JFzuu5q0iEDMoUb3CC/aL+f1ppC+V0h6/nUzfJPD8W85fFaBnu4XnCgxK36NulPLz12yyKi/5nT9ttwIwp6/ROCbqZgdV3wlQFBqBA4eVG9CyH6D54RB5Qhqp2qeqFfOqqAtmorPn82fEon0Ym9qLg6A3gJnWr653I9mz+DYOKyj/jnDlbZJd74Cm4DXY10oO6CaB8EcKJAJBnbStNLrMxSs9RubgBsHsJhs99wke2Z5A0rIhzNQn0V4nRVLJATL5KWjjXem5F5jZ4fyhSf94blGEsZtnLHGrCpOTYjxOYEKvCl1DX3 /LhgVwLM sQ3mD0XXf2i3sMKsXqDOP5rVyAzYMNNqC/+2CdJKi+8OTyIKugNmh2xcSLIJyrLYk8g5R1eFweCPri4ikdMm+auksVpCpSVtXo045JynjgFL3Z3/L4mSwuWUeZS5AOxflFiVQZzNkGYRthJR+rWs1cjO4wYi455JoB5jT4428E5/Pnq7vwK0485Gsia09g2m07xNix9EpByjQkObJgdFegAj/mFR8WdH8N0PDC1azuqhmccRKQTADe7AhFGqRdZN4LmBzVYMldf0mzNxWKW1Ld+2pcWPKt6M4xUidgp1d65JZdrhF7qVvAfaBvJ8h5OckyPLTSo74Yrvm/5I= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Fri, Sep 27, 2024 at 07:57:49PM -0700, Yosry Ahmed wrote: > On Fri, Sep 27, 2024 at 7:16 PM Kanchana P Sridhar > wrote: > > > > For zswap_store() to support large folios, we need to be able to do > > a batch update of zswap_stored_pages upon successful store of all pages > > in the folio. For this, we need to add folio_nr_pages(), which returns > > a long, to zswap_stored_pages. > > Do we really need this? A lot of places in the kernel assign the > result of folio_nr_pages() to an int (thp_nr_pages(), > split_huge_pages_all(), etc). I don't think we need to worry about > folio_nr_pages() exceeding INT_MAX for a while. You'd be surprised. Let's assume we add support for PUD-sized pages (personally I think this is too large to make sense, but some people can't be told). On arm64, we can have a 64kB page size, so that's 13 bits per level for a total of 2^26 pages per PUD. That feels uncomfortable close to 2^32 to me. Anywhere you've found that's using an int to store folio_nr_pages() is somewhere we should probably switch to long. And this, btw, is why I've moved from using an int to store folio_size() to using size_t. A PMD is already 512MB (with a 64KB page size), and so a PUD will be 4TB. thp_nr_pages() is not a good example. I'll be happy when we kill it; we're actually almost there.