From patchwork Fri Aug 23 18:57:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Usama Arif X-Patchwork-Id: 13775722 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 0F48AC52D7C for ; Fri, 23 Aug 2024 18:58:48 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 94EA46B048B; Fri, 23 Aug 2024 14:58:47 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8FE9D6B048C; Fri, 23 Aug 2024 14:58:47 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7C5FC6B048D; Fri, 23 Aug 2024 14:58:47 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 5E9BF6B048B for ; Fri, 23 Aug 2024 14:58:47 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id ED7AF1A1BBC for ; Fri, 23 Aug 2024 18:58:46 +0000 (UTC) X-FDA: 82484421852.27.A2D5CFE Received: from mail-oo1-f47.google.com (mail-oo1-f47.google.com [209.85.161.47]) by imf20.hostedemail.com (Postfix) with ESMTP id 3178F1C001D for ; Fri, 23 Aug 2024 18:58:45 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=fhrSgA5j; spf=pass (imf20.hostedemail.com: domain of usamaarif642@gmail.com designates 209.85.161.47 as permitted sender) smtp.mailfrom=usamaarif642@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1724439443; 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-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=TNFQOMqUw2y0jiSVG8w+iRNgSmXRkQBpvRyasYR7FWw=; b=zRRTnL4SLYGeCecNVILz2Gsvm3tw4RXBKrvE7klEs59Of3iwmvX1eOy5SM/FdkvyLf494e 9Lg/QlTT5T08etBFnadRKlVo/mcqYdwWXTagI+VFajfJ6VvSxdabDAJZ10PRO4f/f4kuwy HNtiyuaVXXgZAnpzrBTn5NlRuAUcb8o= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1724439443; a=rsa-sha256; cv=none; b=ucxtXw4MzJpLErEN0BoJxZFviMHQWcv/1m+O4KRfh6aCFl8UDaf+pC44TXRPrJT5mADoAL vzF1TYJwdchWlaasYuRf26ob50l3n48QZGMVyW2NbMRdSrU7ZJyR2u/jTA193FdwcLv4TF r4fQQn7Ozk6ErgTRAwEoxSgwmejdbE0= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=fhrSgA5j; spf=pass (imf20.hostedemail.com: domain of usamaarif642@gmail.com designates 209.85.161.47 as permitted sender) smtp.mailfrom=usamaarif642@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-oo1-f47.google.com with SMTP id 006d021491bc7-5d5b850d969so1668468eaf.0 for ; Fri, 23 Aug 2024 11:58:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724439524; x=1725044324; darn=kvack.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=TNFQOMqUw2y0jiSVG8w+iRNgSmXRkQBpvRyasYR7FWw=; b=fhrSgA5js9wOeHViVGa4hMARc6+E/j3+Nd6voqxcOdrWwZvnc75yVPzMaQJw7dzb33 bPS2h4kIJhmocH/tbRmCZSm7kVIXx5lL/GrKQDef2gaonICYhOvA4Jz0pWjDWh9M23N0 C0JHHBYInIS71PplBsImUzdBtCAadJFMSxDMUEefGLRZxDMkpLexoJ6MLm6fb7XvYsqM zfMhKgkI2IBrQo1+DGpGICdSCpye1NxjAQ4e5y50yp80LGPENO7RR6ouflTVnhkC5EFd 5Noe1LXiHCvJeR/1pUyqYq9fOA30+8MbgHUJMgUsl5UPA/SJCNUXvzNxgMw5Aj9TpyHW RLjg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724439524; x=1725044324; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=TNFQOMqUw2y0jiSVG8w+iRNgSmXRkQBpvRyasYR7FWw=; b=HEKd8UPl2CVc+PCKDdalam+9Z6VPPupxjvTDAb5+FqR0NusuHwbtk7or/EMv+IltJf jwDmxpOljR0oeo1UbapZIz1/uqiFnqKq0OEdnYTOQOL4ZGTC3jdunSxH7L25zPa3IbNZ Tno7EZiicGpGX77ZvG73Eom0Rn5Tz2ZHUJ1FsbYuTMvtrh5nUv+zvp+Ay6WEPWM9gQ+r HQqr6IE0UPECLEzpFkuG9fkk4RUT2NYOZNQf732RE0sxQ3XXUQnnC9veUObTmKOu9RdS c3C7KVLLlBWAUjvvTGCREHKcZWCFKxC+wQ2OzrgQux+o87wtoXeGr5m2qW1SV11DM5L/ Fqgg== X-Forwarded-Encrypted: i=1; AJvYcCVix5BHBBYOJeBcimtiNTaJaWHBzn38YG3+CuRNTRwuHIoxM0uKiFtTxgbdukICAM+vF+oXq/GIdA==@kvack.org X-Gm-Message-State: AOJu0YzRHB3xvugehB9mMWKZ8XrMIcUKmey1Djj2XwJm5JBgiJL0haGW SKRu+eFRpBm5+fPTkLhJKqgqITUaBmqRq8gDVwj+P7t++17jyXVS X-Google-Smtp-Source: AGHT+IGKfQ0Md5g9XP+SfpH8bxHI4r/aR1OkHXP3WYpfk2ZpHhCI5Yj4RBgJ3NNIXi8lXvJYVtdX4Q== X-Received: by 2002:a05:6358:52c3:b0:1a8:b066:e266 with SMTP id e5c5f4694b2df-1b5c215abdfmr416416455d.13.1724439523878; Fri, 23 Aug 2024 11:58:43 -0700 (PDT) Received: from localhost (fwdproxy-ash-015.fbsv.net. [2a03:2880:20ff:f::face:b00c]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7a67f3181a2sm205977485a.2.2024.08.23.11.58.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Aug 2024 11:58:43 -0700 (PDT) From: Usama Arif To: akpm@linux-foundation.org Cc: hannes@cmpxchg.org, shakeel.butt@linux.dev, david@redhat.com, ying.huang@intel.com, hughd@google.com, willy@infradead.org, yosryahmed@google.com, nphamcs@gmail.com, chengming.zhou@linux.dev, linux-mm@kvack.org, linux-kernel@vger.kernel.org, kernel-team@meta.com, Usama Arif Subject: [PATCH v8 0/2] mm: store zero pages to be swapped out in a bitmap Date: Fri, 23 Aug 2024 19:57:33 +0100 Message-ID: <20240823185838.939977-1-usamaarif642@gmail.com> X-Mailer: git-send-email 2.43.5 MIME-Version: 1.0 X-Rspamd-Queue-Id: 3178F1C001D X-Stat-Signature: pg1qt9sfed8depqx9f9qpkd9dkwczj58 X-Rspamd-Server: rspam09 X-Rspam-User: X-HE-Tag: 1724439524-237310 X-HE-Meta: U2FsdGVkX19HIGZWqkoiHBUvYvCvdWJWOOOKCv3giq1BLmHY0UbOTKyTb1YkwrrT5qyrH6maXZZzpdhbJgox1KiqZRNL5cxq8utzzmbCJNDouI4GLEsHaFNZK4gXeQe8nC9YDwP7UfBkq5zW4a9oQs8IWdLxuiK8Vyo7/NBRg5CUDiZUjQDEDx3Tv2GsuosE0PCpP9wl0Og5Vyg4WMnU6dwVFlZ7sI+6w2ZEkiW/jO5FsP+KPml9Ei6LokEOQSnTdKd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HD53CBAdA3T53mBz6DZwyii7je3ILFEb73J1sLqOgaBnQ3nDm5KGy+qbhrBtBQjVy15N/Q== 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: The original series [1] was almost merged, but was dropped due to a last minute bug [2]. Resending this with the fix for it, by handling zeromap in the same way as swap_map and cluster_info in enable_swap_info, holding swapon_mutex and si->lock, hence avoiding a race condition between swapon and any point where the lock is held. This is the safest way. The series had already been reviewed and acked. Hoping that this attempt goes better than the initial one :) This patchseries is based on top of mm-unstable from today: 4926e8348e10 - (akpm/mm-unstable) mm: optimization on page allocation when CMA enabled [1] https://lore.kernel.org/all/20240627105730.3110705-1-usamaarif642@gmail.com/ [2] https://lore.kernel.org/all/202407101031.c6c3c651-lkp@intel.com/ Usama Arif (2): mm: store zero pages to be swapped out in a bitmap mm: remove code to handle same filled pages include/linux/swap.h | 1 + mm/page_io.c | 118 ++++++++++++++++++++++++++++++++++++++++++- mm/swapfile.c | 38 ++++++++++++-- mm/zswap.c | 85 +++---------------------------- 4 files changed, 159 insertions(+), 83 deletions(-)