From patchwork Fri Aug 23 19:04:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Usama Arif X-Patchwork-Id: 13775727 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 D364DC5321E for ; Fri, 23 Aug 2024 19:05:50 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 535726B01A6; Fri, 23 Aug 2024 15:05:50 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4E5236B01F3; Fri, 23 Aug 2024 15:05:50 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3AC976B027B; Fri, 23 Aug 2024 15:05:50 -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 2255A6B01A6 for ; Fri, 23 Aug 2024 15:05:50 -0400 (EDT) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id B80E8A0C89 for ; Fri, 23 Aug 2024 19:05:49 +0000 (UTC) X-FDA: 82484439618.10.0E1BDED Received: from mail-qv1-f54.google.com (mail-qv1-f54.google.com [209.85.219.54]) by imf01.hostedemail.com (Postfix) with ESMTP id E675840018 for ; Fri, 23 Aug 2024 19:05:47 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=dJec+DAK; spf=pass (imf01.hostedemail.com: domain of usamaarif642@gmail.com designates 209.85.219.54 as permitted sender) smtp.mailfrom=usamaarif642@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1724439906; a=rsa-sha256; cv=none; b=U30kuLlH4irUvt2wW3FhrNDWPTIek17n7pxfVptIBtZ6N+jpvAHxYut51pAI75ZEeDStjf Pr3fzyxwiYUUXnQv5QVT/eLFj8FLhSDe1dvgqB7/g8CLPRIXOGhqD689gTAYir+T0niK2L iErMmTZSFrZgrGdY4IdVzrm1xCAzuXw= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=dJec+DAK; spf=pass (imf01.hostedemail.com: domain of usamaarif642@gmail.com designates 209.85.219.54 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=1724439906; 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=7hnXBn/fKymsE7ALq094qlnFebrZeS47F69tb04fyWg=; b=3S4gKf69WcvGtdMUw0s4q7ko4a4IFeJRmlckvb3D5yPD26IUWS+r6DaEoDdbpMetHiWJUV AUcCErCUUUqbwHjN+oCoXHOzg55R0pITM8tPWnLy2DgCiMJXEr6mjAfPAliFj/zBW3nrtD 7LmzTVWZ8HKqP1DgIP9zxgdtY5Mpu3g= Received: by mail-qv1-f54.google.com with SMTP id 6a1803df08f44-6bf6beda0c0so12268236d6.1 for ; Fri, 23 Aug 2024 12:05:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724439947; x=1725044747; 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=7hnXBn/fKymsE7ALq094qlnFebrZeS47F69tb04fyWg=; b=dJec+DAKb0bIUJLcTone20ass9hZMqksfop0UqjsM7O11infslgLQwhVMXe5DJ2xGf 9oyLdyJcdxhKv0t/b0kOP6DMZkn33tKyH938K2aAo1kDgQSSI7xlDm0XFaY+ygOb4TYw E7tnnoj1zoc5hbaXgAZtO6MJJfg+WUQ3u99T9rqn46ETQ6qgVuu3OjUMD2ODmKfIbgYN /RihSQhTerJFXnreG83mdIISYVzYjKrYzUpOgaSsBPyQpOuRnYWbwQWCUNQ255YU6d2K igR6F/zjKDNmHsKMA75nSa1sas2GNH4a3D4ypMw9DkIobO97JuqioNcL/abrya1ELpNj 2pcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724439947; x=1725044747; 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=7hnXBn/fKymsE7ALq094qlnFebrZeS47F69tb04fyWg=; b=NJKgKgsXCy034Ae0lQkxyj4iqAJFa06whOUp/6QdkpKZiS009K1DhAly47eZ8Pqrnu FBf5HEoPjomn2E3sdlhgUwxrs8rfx1Kj6iS8uNGGrfd74lq2vNcORg92kFQpbnED5u3v kWBdl0p9lRcx0Bn6tVxrIHD551/fLsdH5+pnRRlINriUeFlt3rTZHUW2vdQe4u17FKDG qaUrhIBOxxuXBremjcUUwAWXviv+kCyJ2A00tbmJHz1YqX6DVYWZesUguj7y5/ZIbmiS ZTKckBgW4XXl/ljIGqMVrthpSkEUreWZ/ZSrbUdf5EzdD2iVE0AGywlf907WdNcfjqDH l2EA== X-Forwarded-Encrypted: i=1; AJvYcCXTT8TgmOu+nzw6kYuBJH/owLC0gTgAwRN7muTWzagV6t1yg2l56rEAJFezgNzDHdfkXYORXgBS6w==@kvack.org X-Gm-Message-State: AOJu0Yx2xm2UmYRg+ae2FW5oGORk71QDVOr/xU7LOLF5dVr2ZvxkjJOD pWjGrcN18KV4m4Oq4c5CYMbS6DSE887lTbMIYHjsbiZUU3B59YhF X-Google-Smtp-Source: AGHT+IGb6uozWgs6YOOHYAREygi1zTfCuWtkYKG4WQ1tsg+5T4m5Gugr7+luUwVK2XjE0PY/2ER+kA== X-Received: by 2002:a05:6214:5bc9:b0:6c1:6f9a:17c6 with SMTP id 6a1803df08f44-6c16f9a1a0dmr30087866d6.54.1724439946739; Fri, 23 Aug 2024 12:05:46 -0700 (PDT) Received: from localhost (fwdproxy-ash-009.fbsv.net. [2a03:2880:20ff:9::face:b00c]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6c162dcd5bfsm21345086d6.110.2024.08.23.12.05.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Aug 2024 12:05:46 -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: [RESEND v8 0/2] mm: store zero pages to be swapped out in a bitmap Date: Fri, 23 Aug 2024 20:04:38 +0100 Message-ID: <20240823190545.979059-1-usamaarif642@gmail.com> X-Mailer: git-send-email 2.43.5 MIME-Version: 1.0 X-Stat-Signature: qaoffjizjixy4udy1fcfg1wkzfwy6n4q X-Rspamd-Queue-Id: E675840018 X-Rspam-User: X-Rspamd-Server: rspam10 X-HE-Tag: 1724439947-862239 X-HE-Meta: U2FsdGVkX18OtwW0qCEV5W7mXPXXuLsiet1JHx+mwf9p9XCAW4hnYz5Wm/zBqmvGWfOSh3SXroDyJByFp2DJnpUHVtBI2bnfo08wV5+qIM78NA5xtM53T1yWhg+yNPSyKLpYMQg89Y0UmGsrO/GNoDiOJzGUL/uVrDWo6x70jZ4p9MxIMYYyyWxgO+Dlx5cLQj0KjEcawCg2SWCGVH30VAh3qNracGIEG0rOz3ApymKkZviowGqdp2VrNstqQt5Z/SCwweGzP1KRc3EFFl3CuCaCnfIiwbz9oy72HYar14fQONx1u7CDBCq6YtS5PmlwO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JHg== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000003, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Resending it, as the CC had "Huang, Ying" in one of the initial patches, and it was rejected by git send-email because of the "," in name. 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 by all maintainers. Hoping that this attempt goes better than the initial one :) This patchseries is based on 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(-)