From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-f169.google.com (mail-pf1-f169.google.com [209.85.210.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 40A1034CFC7 for ; Wed, 5 Aug 2026 14:11:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.169 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785939114; cv=none; b=NOdeEjs0oB3LIjeDhyLir2BPWRkYG3CJ9cB+0gwwzzgODwZIhM6jdxruYeJMuefJWB2ublKEhbSzXtLp7jDq8sZsJsXJakuRT3NRjPdvd/fJXOrLnvs5Vk7hzi4qj6earT/qOt6MMuUZDJkf/XZEIS8zF6i99btc4pq44pFV5tU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785939114; c=relaxed/simple; bh=UG6BbmFV+dAMWqJ0TU99KDRYqsyjEpT26kxDVYQ7eHQ=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=OzHiomwL9OsKhqULDPAd2KbWQaXgssZVZvpoUfRwtCvViz8CerCwEkHIqQaAQ1CYunEJh4sFShxx6cJl/jFPRUOa/io7k2oUNU5GD+Kl5NNTU2hiHSeE31G6F2VTdAKXlBzJSBUM2eH6DdYCakBeYK2OHgJhQZotCS0ru9VkRIo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=dn1+uJUT; arc=none smtp.client-ip=209.85.210.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="dn1+uJUT" Received: by mail-pf1-f169.google.com with SMTP id d2e1a72fcca58-848761b5897so784589b3a.3 for ; Wed, 05 Aug 2026 07:11:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1785939112; x=1786543912; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=eFjaJr+M2H0kL5N6nM0BTOJS3VJmwR+FQgMk7+rxLY4=; b=dn1+uJUTj3/WSdF0TL5gGX/GuojCmwV8KGjpIPXp7oIFdVlY0od8xCvkV+bucqWYmC r7T7dy++hpa+D7brIGVk4q0N0UIF8qtR0nCNyCA0Gcr4wzK81PIwYpLNaZpziKA6hZ4I LmIXkbrIJLV9JQJK+mQzW6WRL7tiREkDYui//FovP4AcqTzUJfV5iNvC9BwIvjNcjhji FvArqH10rQ2c7Zal79JBDe9mYcSsE0RIJKg+das41HSh2XulhGSn5GWbwESXCegHaXTW gq+6jUCKuRPYFmrWX8KGzBsaQgWzzW+dkGRyHU8U8vRamPNYklclvpazBNodpPEVVU01 6ygw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785939112; x=1786543912; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=eFjaJr+M2H0kL5N6nM0BTOJS3VJmwR+FQgMk7+rxLY4=; b=BjuwfgXxA5KcNbvo9m8txEtiC6CnG0KrDrs0Jxn7XHixc9bxSqY+CWBnRNhyd01nwZ lrWKdzjAg4PlcKZ/h06TTmWJ/1bHM/NtC2v7hMKlbZZbyQkhML7+uhscQ7I8paVEs7Jt NzYaGox3At6Th20w96TA7w/y02eilE7S/tyOxlIZ49W2VD9G8jaCZ5v+Dx4clbpw0I/Z ROw15J5Pz7em/RBYJemsUW4L7OEo7q/o+QhSOBDmvz20AgvPz8foh/tF/hnBgG7pmw49 eiSGvWOLQEGuLe74cn9pQ/ARYCq+1Oq5re6pZx5cCtyFFLILCDWffJZtigVGVnjqr7JG 0Z4w== X-Forwarded-Encrypted: i=1; AHgh+RoqqRT6y1ykfXYbjC5FM3TYXu7cKb7z2yP4kkqxQtSz2LKjtmnt0Pz2/NdyhGH5qWDJ0hJLKnf44R+jNZA=@vger.kernel.org X-Gm-Message-State: AOJu0Yze3iIOa7DFFLqolk37GkyNZ7dAr1bMTssSAUklNBPYB8q63gg9 oTNyijJeEbNZ4b4M1dt8evgRxT0VIRXzSxs4iBKmG4jgUe7230MWofRJ X-Gm-Gg: AR+sD110/h/Ls//jRkUCsZm84eBIR4bvrLldlzbdmlmzozxNT5xRvxaiOBu4dA+wUM4 0oUnUSr9rWeI5/uvocUhTD6P86DsNNTsrmG7crm/8kXx8YzM248e230AQGj9fqwe0NHmrIWt6ec a5VS+QJ6s5gFnTyiaa02LnSGzm4vV/HVHjDK6V9ICR1E10oCHqps6OvviuYb6+5FyO6YfoI/nDJ YqUugCBTPBJHE4gAUue2GFvU55AqLLnc+vPeAPkyQj/i2M1m7ncgrA0olCrFnjWNeTXPLEnELkK ZLb4EkRYgC93pDOFW457qFmcAUD7UVQ5VT8ypXv11ZnpFavgz0DnplgXdxwcu8xk/QL7TLeLX75 H74Hk4dTOjS3rjeTXfLFZxq3uDIEuAyRMzqKLoKBu3Ok6Uv8eF0DNiPHXUnGvBF5ixrHW5QLeaS 3RlPCQEQYbLfx1qUStnRxTFFwkYEQjtgTa9wLXf+tQKPzV7myel3ahtO5xQGMtnmQGAKQxceme5 lD8gMqFKPN88BXREGdPo7Fvdz10buSy6amKhN65O7yzsADCBeueLEcuIbjc X-Received: by 2002:a05:6a00:194f:b0:847:8971:87bb with SMTP id d2e1a72fcca58-84f2e00ea47mr6381590b3a.21.1785939112218; Wed, 05 Aug 2026 07:11:52 -0700 (PDT) Received: from localhost.localdomain ([220.85.166.190]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-84f2e50846esm913940b3a.46.2026.08.05.07.11.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Aug 2026 07:11:51 -0700 (PDT) From: Youngjun Park X-Google-Original-From: Youngjun Park To: Andrew Morton Cc: Chris Li , Kairui Song , Kemeng Shi , Nhat Pham , Baoquan He , Barry Song , Youngjun Park , her0gyugyu@gmail.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 0/2] mm/swap: skip empty clusters in the swapoff scan Date: Wed, 5 Aug 2026 23:11:44 +0900 Message-ID: <20260805141146.127776-1-youngjun.park@lge.com> X-Mailer: git-send-email 2.48.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Youngjun Park find_next_to_unuse() walks a swap device one offset at a time. Slot state now lives in a per cluster swap table, so patch 2 dismisses an empty cluster with one counter read instead of SWAPFILE_CLUSTER table reads. Patch 1 is an unrelated one line comment fix noticed on the way. A debug test confirmed the skip path runs, and swapoff completed under load with no DEBUG_VM or lockdep splats. Changes in v2: - 1/2: reword the comment to "array, one entry per cluster", dropping the redundant "on every device" (Barry) - 1/2: pick up Kairui's Acked-by - 2/2: drop the min(), the swap table is always SWAPFILE_CLUSTER entries and swapon() masks the tail past si->max as bad (Kairui) - 2/2: mark the unlocked ci->count read with READ_ONCE() for KCSAN instead of cluster_is_empty(), whose other callers hold ci->lock (Kairui) - 2/2: expand the commit message to cover both of the above - Rebased on mm-new - Link to v1: https://lore.kernel.org/r/20260728155907.391820-1-youngjun.park@lge.com Youngjun Park (2): mm/swap: fix stale comment on swap_info_struct::cluster_info mm/swap: scan by cluster in find_next_to_unuse() include/linux/swap.h | 2 +- mm/swapfile.c | 41 ++++++++++++++++++++++++++++------------- 2 files changed, 29 insertions(+), 14 deletions(-) base-commit: 0b53bff4fa05ff0d3ffbd3d3bb10fae69dfab498 -- 2.48.1