From patchwork Fri May 24 03:38:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yosry Ahmed X-Patchwork-Id: 13672648 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 EE0B4C25B74 for ; Fri, 24 May 2024 03:38:25 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 81E726B0092; Thu, 23 May 2024 23:38:25 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7CE066B0095; Thu, 23 May 2024 23:38:25 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 695EF6B0096; Thu, 23 May 2024 23:38:25 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 4A5786B0092 for ; Thu, 23 May 2024 23:38:25 -0400 (EDT) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id BD95B140820 for ; Fri, 24 May 2024 03:38:24 +0000 (UTC) X-FDA: 82151881728.08.089EDAB Received: from mail-yw1-f201.google.com (mail-yw1-f201.google.com [209.85.128.201]) by imf26.hostedemail.com (Postfix) with ESMTP id 14176140003 for ; Fri, 24 May 2024 03:38:22 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=O65r62yw; spf=pass (imf26.hostedemail.com: domain of 3rgtQZgoKCD8zptszbinfehpphmf.dpnmjovy-nnlwbdl.psh@flex--yosryahmed.bounces.google.com designates 209.85.128.201 as permitted sender) smtp.mailfrom=3rgtQZgoKCD8zptszbinfehpphmf.dpnmjovy-nnlwbdl.psh@flex--yosryahmed.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1716521903; a=rsa-sha256; cv=none; b=hBG789LEhYSmQ0xqj+GndNSjNSML/r5EgKhsScPF+wefOkCLOZweF/Raxh4t5QhGbGCAwb rNr9Gm5mx8in5us8qY1TT2+dJK2AHb3mPw18v0YNN2LolCrgOluVj/WyeJVHg8OBqxkS23 bZFYZWMZIW2F1f7kJuz3fKq3bLueF/k= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=O65r62yw; spf=pass (imf26.hostedemail.com: domain of 3rgtQZgoKCD8zptszbinfehpphmf.dpnmjovy-nnlwbdl.psh@flex--yosryahmed.bounces.google.com designates 209.85.128.201 as permitted sender) smtp.mailfrom=3rgtQZgoKCD8zptszbinfehpphmf.dpnmjovy-nnlwbdl.psh@flex--yosryahmed.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1716521903; 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:in-reply-to: references:dkim-signature; bh=c6RztChgfOm/HvAmhxH4gX1dCxuVITCX+fCVI13JQXo=; b=b8G65dz4gI/ZApqRIlRbSg7zXnCSyOCTbdR2C5WVqfOC5+ic72aYWfQ04bm6GfDP4YYaLa YzGuAo9vh+fr66UqMyweRGoNcVAaoIZh18O6XuB6wBT16ueGOBxFMDhvnaW7xjN3l69Cn3 dESrb/6IQvniwrxmRO+eKHw0Lj73rl0= Received: by mail-yw1-f201.google.com with SMTP id 00721157ae682-627ec18b115so42509627b3.1 for ; Thu, 23 May 2024 20:38:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1716521902; x=1717126702; darn=kvack.org; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=c6RztChgfOm/HvAmhxH4gX1dCxuVITCX+fCVI13JQXo=; b=O65r62ywDwjBsLGq3TOHA9Lm6Nt+vWnR5Ke2Daaql372WhEzNfKrwlc/bSRb4bZGJn LX41tiTjWFVbM7HL4deUNxlwpPb1zsV4eubtnok18eufp3AlaLgWksusMq0ubR84Npyq LhJueihTlVziFdFur5wNAJjOD+ddgetf6KKLdsC70oFs4cGC6gQ5Bd3GXQU+7DONlGpK hafpt213Rzzjo9VChMcR0II5CcAGzmdyH+BkyrgHi0BvpZEGavp4S4PZXLKMqdHO8nov /F7xsDQKrtGMbDMLSNj7ENfSumzUt7jEFNmmS9dMXHboMKd+YIzX69p2qXJW4NSQJW6T UWMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716521902; x=1717126702; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=c6RztChgfOm/HvAmhxH4gX1dCxuVITCX+fCVI13JQXo=; b=YOkA+lOhbpvKXgHmIN7eN+/I54EavsupO/hNbUP7eF8PXBQNT/fHFN4wycLqIrVq/W D3GbraQlE8BuSmms8CBKk1crzrwZodh/m0FpX8BEhjza8I+6gH/D5A2lyX3704xCtzyc C7kzv85BfFNVz3hlFvBpxwNLyq1zL3ciFtKliQBPvZYTKdhX+lEbOlLRsiUXSvgH1HK7 y0fG60/5wzrht6ho903T4RfT8n3cyG+U/D78GsPK8NeIRWa+Pz+sPrVMWoGWbaDjSwSF DElB3dM92hso3pIPvlxhHToE3rMAm4XhNx6u/+Gb0o53F5xHfp4g6weETY7tjaIl/2K+ 5uPg== X-Forwarded-Encrypted: i=1; AJvYcCVmVKs25SMNC5bsGbyuQujD1LXI9UQmwCuiUcfi4vc+UULz2xck+E/eQVVVMIEssFmmqHCv9/IE5XK3vCFiNtAjqf4= X-Gm-Message-State: AOJu0YwnCs9qdsa9YCdf0elYT2mAbWmGqPl3B8h3tQQXQptN5H9Ke1o+ zcV0+3f0H3a0R8ai4NGrXoRDi/CPD1soxmsmB6Fp9ovgVFmnYwdlXmkusnlWq7Cv0Ye3tWFbTsX 0RH1IbHl/1PU0WfME9w== X-Google-Smtp-Source: AGHT+IEplun7o3mqZedFSn0QqQ8XWW2EegcnZ7FYhw/xvSnovDyoGDS2OZkMs6NYdwglbvHK79b+ghmibqX2BphK X-Received: from yosry.c.googlers.com ([fda3:e722:ac3:cc00:20:ed76:c0a8:29b4]) (user=yosryahmed job=sendgmr) by 2002:a05:690c:6486:b0:61d:3304:c25e with SMTP id 00721157ae682-62a08eeb028mr2893387b3.7.1716521902025; Thu, 23 May 2024 20:38:22 -0700 (PDT) Date: Fri, 24 May 2024 03:38:15 +0000 Mime-Version: 1.0 X-Mailer: git-send-email 2.45.1.288.g0e0cd299f1-goog Message-ID: <20240524033819.1953587-1-yosryahmed@google.com> Subject: [PATCH 0/3] mm: zswap: trivial folio conversions From: Yosry Ahmed To: Andrew Morton Cc: Johannes Weiner , Nhat Pham , Chengming Zhou , Matthew Wilcox , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Yosry Ahmed X-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 14176140003 X-Stat-Signature: 5dye94fz899x434qsf98gwicwtifqqhc X-HE-Tag: 1716521902-343283 X-HE-Meta: U2FsdGVkX18hJybB/Wmizk/YQ59YYI606DNlNNlyLm8tgUD+etRdz/shU+8yLgc6ZntDq7gAu5lekXcKIpyiMQIyfxKFMNkw4fTy0H5t+7iiXjFEOwLzxHOkefRvc70RxPkgssAcLmly4r9k6Xh0+4yOwBO0vOjU30QmQxBxfLnCgcSH/s64QQXbsZezJGV5coeYemsrLVTbdG7BUg1Cx1FR5Ma+Nj0FihixQAU5JmznA8pDlYkhzrEB76MfYbSw0ttyjSX+nrIsvDGKIejQG+3EZobKwBqTLovwsdQ7c6eWZGQwZ5V1vw9aUnHvx713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yoKi6goCkyOaVQYf5UPMgLtcR61SRexIFIW8pINJ9eA7CAG+znjJMxoFM7XFSw0Zo/0FrEL3PiCbFMklDhN5joVIVCoW1JurpsbzlyQAUXWhqsTKLfhAczSuhdi/RMjINoN+lH9U/kjwJjybAkr5qY1tYJxEnHQzloT93Dt13VGfsnqOmSvAL3Ox+6WWdyvLeCq+qU1TOSFhg= X-Bogosity: Ham, tests=bogofilter, spamicity=0.001299, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Some trivial folio conversions in zswap code. The mean reason I included a cover letter is that I wanted to get feedback on what other trivial conversions can/should be done in mm/zswap.c (keeping in mind that only order-0 folios are supported anyway). These are the things I came across while searching for 'page' in mm/zswap.c, and chose not to do anything about for now: 1. zswap_max_pages(), zswap_accept_thr_pages(), zswap_total_pages(): - We can use 'size' instead of 'pages' and shift the return by PAGE_SHIFT. This adds an unnecessary shift, but I doubt it matters at all. The motivation is to get rid of 'page' to find things that should be converted more easily. 2. Counters names: zswap_stored_pages, zswap_written_back_pages, etc. 3. Comments all over the place reference 'page' instead of 'folio'. 4. shrink_memcg_cb(), zswap_shrinker_scan(): - Rename encountered_page_in_swap_cache to encounterd_folio_in_swap_cache, or even better: folio_eexist or hit_swap_cache. 5. entry_to_nid(): - It's tempting to try to use folio_to_nid(virt_to_folio()), but I think this adds an unnecessary call to compound_head(). It may not matter in practice though because the page is always a head page. Yosry Ahmed (3): mm: zswap: use sg_set_folio() in zswap_{compress/decompress}() mm :zswap: use kmap_local_folio() in zswap_load() mm: zswap: make same_filled functions folio-friendly mm/zswap.c | 41 ++++++++++++++++++----------------------- 1 file changed, 18 insertions(+), 23 deletions(-)