From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A7CE0606A689 for ; Thu, 3 Dec 2026 22:00:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=NgO53vR+ Received: by kanga.kvack.org (Postfix) id E2AE06B05B6; Thu, 3 Dec 2026 17:00:22 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id E02AC6B05B7; Thu, 3 Dec 2026 17:00:22 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CF1ED6B05B8; Thu, 3 Dec 2026 17:00:22 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id AE2726B05B6 for ; Thu, 3 Dec 2026 17:00:22 -0500 (EST) Received: from smtpin04.hostedemail.com (lb01a-stub [10.200.18.249]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 993638019D for ; Thu, 3 Dec 2026 22:00:21 +0000 (UTC) X-FDA: 85504041042.04.BBC4FAF Received: from mail-yw1-f179.google.com (mail-yw1-f179.google.com [209.85.128.179]) by imf02.hostedemail.com (Postfix) with ESMTP id DD9F880009 for ; Thu, 3 Dec 2026 22:00:19 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=gmail.com header.s=20260707 header.b=NgO53vR+; spf=pass (imf02.hostedemail.com: domain of nphamcs@gmail.com designates 209.85.128.179 as permitted sender) smtp.mailfrom=nphamcs@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; d=hostedemail.com; s=arc-20220608; cv=none; t=1796335220; b=ca1SRPTalZDqh8gtAoAZJHMFKGP0aR8Vn7TPOodvlC27APqzAYpPVF96pywj0W6DPyyB7/ MPv0yogjqkoo+UH7cLHkRjpsbv0i+waf5ieVAcdXZemx+rWyk8j3h6djM6RJ5/4rGoeEE9 f4AHajVT/AoJSxK/G1AzZk5ni1VGudI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1796335220; 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:in-reply-to:references:references:dkim-signature; bh=Fsj4ssZKA791hjrXJ5AeKjVlIj/lK4V9bPoG18xPtZA=; b=5h4tYJactJHxDF8101mrhG38NFQjUksn92y7vmXysbwu0ZBiVy4+95Lc0eFaekHxCyhXyA yiKwHaD3T1q6PwKC2aAbzrRFqxSMh/Y17o5u6j755/PuZhKom9imHQAeem9BzH7eMvqYrZ 22NQZX+aue5GSe+K32VvA64+VvpVVZo= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=gmail.com header.s=20260707 header.b=NgO53vR+; spf=pass (imf02.hostedemail.com: domain of nphamcs@gmail.com designates 209.85.128.179 as permitted sender) smtp.mailfrom=nphamcs@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-yw1-f179.google.com with SMTP id 00721157ae682-8b2d14968c9so2937637b3.0 for ; Thu, 03 Dec 2026 14:00:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796335219; x=1796940019; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=Fsj4ssZKA791hjrXJ5AeKjVlIj/lK4V9bPoG18xPtZA=; b=NgO53vR+ey7/+7idYqGjnKIdLcavcZ+K9EZWei4b+nscja9zdFUukQt8E4Ab8G2pgv ZqqzuG47MTvEwv3wFAT3S+RUDxmo4Pt95aHDy0VHrUt+9WwidjX1kXNWfVs3TbFXBkuj pFZ2OW1FmQ8DYqQgle7K60pg7XwOS7KIb7zwrVxFmg5pKQDoU81VBOa/nKegyZXSXYZT ulVCNmn80FcTJW3o88NK0xcw88e+C4oyc9MnFScM81DSo23Fnr7P6n8fByuWpZBpDJT/ 5M2enwIX1XvC1MWORuDEbD69Nb6v0pVUrcI8BZ4cTCT3fRiWMZbB2lxlv53/eX/zc5lP p4Fw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796335219; x=1796940019; h=content-transfer-encoding:mime-version:references:in-reply-to :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=Fsj4ssZKA791hjrXJ5AeKjVlIj/lK4V9bPoG18xPtZA=; b=gbwlB+qyyqJnJd2B4FYhE/mcaz9Z+LoOZnwvdXaX8RzJrx8YlzGkcDQKFwOSkp0vr4 lrKAHQvZcKjlqq80z/pzK0aDpQOV6070KdOim0x+01k+mv9s5yNRFpxTyFIGDKN9Grot hRTgRbWeojg2ZfpPrt529DE6YJLx6FrbHeosHknq6Rjcs+Y5LjVJOxXlwMwZg7x1mdr0 SMXb5EVPbn2KFv/cJN66F3w5o/6OYL8tQbNd+gb91eVOZxS/2uVH36u9fAhbBzwHmq9f 9y9fNGy/LRANC8HunXzsDcOgc6OxKF5c5Zgv2kdIzwnPXBye4ju7/LhnNWWGJATxEyiN zunQ== X-Gm-Message-State: APuU4Z+GcrvrMuHps/rwU1iDhOHI/7MxwRjqdi8XBWO+tDP/+auIdy3n +874RPxMxeD03+cAr1MSx6hGS18spUvVL5Mh02n7kES6WYMHATySAvOg5gNdgawW X-Gm-Gg: AZFdTZd+F+MC8cqALccYslIv5uoYy3EYqKoG4ly2IQVpRkaPlxNFJG5sd5VSN7g5hBL B7qeBEEpWp5K/9rzWeoz1PHDt4Gouem03t3D61xKjHz+7KpXLcNLglQd0i5upSjqtYdqY8mlcUu pQYVcYCYBh++ko5x2WI5LSFaRHEj2mQcPQOlfJGYhc6ekxxmLHib8x/pfYs1IqpUiVOGCJQTqNd lAqSophGlYHiNPTJVMLHGflN4ugeKu/FFLiSPU2fM72KuL6/wIDg/NzJ/IHfsMFDjnm2KjeBxnW q048G6maQj/uTBw4FncRH9QRiEWzUJ9G2fbZh9sk4JDsFG/0oXq3V+/ecEaePPKe1gCWUAYRwxd 7w0Wz+mhDbO2AEAhp0D6O0H5KgF6Y9MG9vGdoesqi1Evmfc1kndliIy+UMdAsZT37wbLOICbXlq bym8yvllr2HtINqOVGUG6M86bahtrYM0CzOuwaHSxCruub/7pSM+PsREY3YPAqCp8EVlxyexouM WBK4/0Ti2jRjFaeizGiybY3EN3HpCPSZE0Ri0JENClHLlb46sa0woQ9IzXFl9cQXaiVdmtt3BeV Qp9WcSmr9VwV6GhQhdN8Lnq4PcrPsKPXcL+5yT1y0+hud0LsPc3kEA7tgVq2FXhg3zLfuxsOVdD IqjkY9ledF/Pn5+b7CoF6QmnIC98AbEgLnGQqgp8= X-Received: by 2002:a05:690c:443:b0:8b3:6d4e:3f60 with SMTP id 00721157ae682-8b660dbfa85mr969727b3.61.1796335218837; Thu, 03 Dec 2026 14:00:18 -0800 (PST) Received: from localhost ([2a03:2880:10ff:55::]) by smtp.gmail.com with ESMTPSA id 00721157ae682-8b660d9a917sm1013587b3.29.2026.12.03.14.00.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Dec 2026 14:00:18 -0800 (PST) From: Nhat Pham To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Andrew Morton , Chris Li , Kairui Song , Kemeng Shi , Baoquan He , Barry Song , Youngjun Park , Johannes Weiner , Yosry Ahmed , Chengming Zhou , Qi Zheng , Shakeel Butt , Axel Rasmussen , Yuanchu Xie , Wei Xu , Baolin Wang , Michal Hocko , David Hildenbrand , "Liam R. Howlett" , Vlastimil Babka , Mike Rapoport , Hugh Dickins , Jonathan Corbet , Shuah Khan , Randy Dunlap , Roman Gushchin , Muchun Song , Arnd Bergmann , Karl Mehltretter , Dapeng Mi , Marco Elver , Ethan Nelson-Moore , "Borislav Petkov (AMD)" , Jeff Layton , linux-doc@vger.kernel.org, cgroups@vger.kernel.org, Tejun Heo , =?UTF-8?q?Michal=20Koutn=C3=BD?= Subject: [PATCH v7 04/20] mm/swap: allocate virtual swap slots Date: Thu, 3 Dec 2026 13:59:54 -0800 Message-ID: <20261203220010.1302207-5-nphamcs@gmail.com> X-Mailer: git-send-email 2.53.1 In-Reply-To: <20261203220010.1302207-1-nphamcs@gmail.com> References: <20261203220010.1302207-1-nphamcs@gmail.com> X-Archived-By: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: DD9F880009 X-Stat-Signature: 1hi3zxj838fthffwxknwa8m79915nywn X-Rspam-User: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_PASS,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=4.0.1 X-HE-Tag: 1796335219-795024 X-HE-Meta: U2FsdGVkX1/VgNztLRwKcv2ApooaMASSKTHywuLnPu097Wy7lIJSdxsssQtOptMpTBGr6eWzzVPdfvKXUrLjtSgLt32G33U8lCn4wHuzPPwSNXJQ4XcuBjEVY66QeeOkLqjNIKmk+bVRmY2UZvYYWuBMC4dV6zKbz7+HOmxBYctvBXKawICEZRJgOI2p3anWxHlEHbzyYeqmMJ3nashCHSpQ3XJAtmGFOREzYCxgnrt61BN3T006OU7v3D0xtHnXd/WIS2Lt5eTU8t6JHEr+sEnRjvkHN6s8U6qNpFOOaABSIlxOWPhU5dHpWx0tcostBqFpN8ZdH5ItSWfBwPeIvvUG7WYLJyJ0FItGDUaU3FPOxfUVe/6qpYfprmDgcgCdL6G3zejQ2SRKqhVI7MXLQva+D467vQjcZClcvUy3PW1p3iMRAeXx6z6fv2Ghhscc/bvtWLegeGDHLXSmBVmf0qZsyUj3usCfLlNZfH+s0Waetf3AqEvupGoVq+GwblM+u6s2H30mHdhzIomci2AIG7nu6R0reGdfhuUe2BiHLP59QqshPrLT+0m7EaGbsWfyQZgD/VcCsdrnswfXc5miLx3qkyzPH5kEVJnkucRXoapt8+OA0gT9cuWfiGalkAYplp7ZkB0Fjd1Sy8NNpgrkPg+Uo+U3+/TTb/LNc36x05kLMQ0jmQVZ+ecopPWM24od7ov4qvFueJiZRGP4CkYFPgwz4lYDaoCxF8igcuoA79PzhLvfSFmtL9iXcFAxP7m9+lc7EuOQ3/qcwhIc82FDEpNhFaiKCWCTbKwSambxa6OB2vA6FygUg8MRuyv66N4mecO5DHXggCof4nK4hgTwg/MZdzt8f00CmxgSNNO7jyFe+fcTF+GjgTYoJ8PhEl910Sf3IGhUlrcX5XCwbtxZ4QQjuvLd2ZZ6R8cz38ZvdRcfjlZW1jlfWue0QzM6cd4JYLUBnWNNlIEwZ2yYsQf Mk9N6lGb ple17OQbf7nWQkC7fPI17SuvjEdFrSQZFJAvjR/u7eDtT5rWqqMLZTagsI/6U28i8K75oIL6s8d6y2T0v727Jaf+zelPvoIuraH8S3GholLO2xYvtsb/DYDWYbw0tDbqKKgMAb/0PjJhQFW1G4fpAIhyn0/7UKSQnLYwgE9dCkixyLbfKS2gZ3p2lex6D2/wD3s5xil2dRiBh4ORnV8KRZy7dN3T/pEkXt2zz2QvvAqMwmW5bnO9TfVhynkd7VuvlJSPZrhYy8zBTwpTLehLl8jF0bltjG0Z98mU0sSx3ITXl/qL7hBuccEOMSRzEXU7priaeJ8AB7rHFaMoTFwV/lU7K8ycg4UYNiKADzoZOKWeqV46ZsB1TOl860eaDtl1dnI8Cd3AJ78ngw9VDiJWONPmCp7vQ/HwStsvws/NFZifGkbf4s2s64g+61ZjlL9PH56Z5YjYqPQ0MEEgn2ZeFxEOng3U+N7KRfTnB8xEuEax0u0jKn5ATdOjlzY9MsuKoTdJZPPPJPIKIYYwrH9KlXlln0MgV2SDML9P36JO5D+2SbcAcEsPFYesg9mfa5N1vWoThzaEJU/nnVHM9eOZy6RZ8bKz/wiPVffhTs1YqSZCNP190bqmYzX+A4PlJI3A15OpISCNQzD4iUDLdXkL7Ewf1oEsovN0MZEuhTOXSIOEbfzXxJKZBmgOZJo6zWQ9e7fPBfHC2OBpLNWISjyPdxrGI0A== Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 Virtual slots need per-CPU allocation hints for their own device. Add the virtual allocator and select it from folio_alloc_swap() when vswap and zswap are enabled and the cgroup permits zswap. Reuse the cluster allocator while keeping virtual slot usage out of the physical free-space counter. Avoid reclaiming virtual slots merely because physical swap is full. Retain direct physical allocation when virtual allocation fails. The selector remains gated by vswap_key. Device registration waits for the physical backend so writeout can fall back to disk when zswap rejects a folio. Suggested-by: Kairui Song Signed-off-by: Nhat Pham --- mm/swapfile.c | 101 ++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 93 insertions(+), 8 deletions(-) diff --git a/mm/swapfile.c b/mm/swapfile.c index 1387c8bb1e97..aa08111bea62 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -131,6 +131,16 @@ static DEFINE_PER_CPU(struct percpu_swap_cluster, percpu_swap_cluster) = { .lock = INIT_LOCAL_LOCK(), }; +struct percpu_vswap_cluster { + unsigned long offset[SWAP_NR_ORDERS]; + local_lock_t lock; +}; + +static DEFINE_PER_CPU(struct percpu_vswap_cluster, percpu_vswap_cluster) = { + .offset = { [0 ... SWAP_NR_ORDERS - 1] = SWAP_ENTRY_INVALID }, + .lock = INIT_LOCAL_LOCK(), +}; + /* May return NULL on invalid type, caller must check for NULL return */ static struct swap_info_struct *swap_type_to_info(int type) { @@ -236,7 +246,8 @@ static int __try_to_reclaim_swap(struct swap_info_struct *si, need_reclaim = ((flags & TTRS_ANYWAY) || ((flags & TTRS_UNMAPPED) && !folio_mapped(folio)) || - ((flags & TTRS_FULL) && mem_cgroup_swap_full(folio))); + ((flags & TTRS_FULL) && mem_cgroup_swap_full(folio) && + !is_vswap_entry(folio->swap))); if (!need_reclaim || !folio_swapcache_freeable(folio)) goto out_unlock; @@ -585,7 +596,9 @@ swap_cluster_populate(struct swap_info_struct *si, /* * Only cluster isolation from the allocator does table allocation. * Swap allocator uses percpu clusters and holds the local lock. + * vswap clusters are destroyed rather than freed to si->free_clusters. */ + VM_WARN_ON_ONCE(swap_is_vswap(si)); lockdep_assert_held(&this_cpu_ptr(&percpu_swap_cluster)->lock); if (!(si->flags & SWP_SOLIDSTATE)) lockdep_assert_held(&si->global_cluster_lock); @@ -986,7 +999,8 @@ static bool cluster_scan_range(struct swap_info_struct *si, if (swp_tb_is_null(swp_tb)) continue; if (swp_tb_is_folio(swp_tb) && !__swp_tb_get_count(swp_tb)) { - if (!vm_swap_full()) + /* vswap slots are abundant; never reclaim to reuse one */ + if (swap_is_vswap(si) || !vm_swap_full()) return false; *need_reclaim = true; continue; @@ -1058,6 +1072,9 @@ static bool __swap_cluster_alloc_entries(struct swap_info_struct *si, */ static bool swap_prefer_free_cluster(struct swap_info_struct *si) { + if (swap_is_vswap(si)) + return false; + return (si->flags & SWP_PAGE_DISCARD) || !(si->flags & SWP_SYNCHRONOUS_IO); } @@ -1105,6 +1122,10 @@ static unsigned int alloc_swap_scan_cluster(struct swap_info_struct *si, out: relocate_cluster(si, ci); swap_cluster_unlock(ci); + if (swap_is_vswap(si)) { + this_cpu_write(percpu_vswap_cluster.offset[order], next); + return found; + } if (si->flags & SWP_SOLIDSTATE) { this_cpu_write(percpu_swap_cluster.offset[order], next); this_cpu_write(percpu_swap_cluster.si[order], si); @@ -1255,7 +1276,7 @@ static unsigned long cluster_alloc_swap_entry(struct swap_info_struct *si, * Swapfile is not block device so unable * to allocate large entries. */ - if (order && !(si->flags & SWP_BLKDEV)) + if (order && !(si->flags & SWP_BLKDEV) && !swap_is_vswap(si)) return 0; if (!(si->flags & SWP_SOLIDSTATE)) { @@ -1304,7 +1325,7 @@ static unsigned long cluster_alloc_swap_entry(struct swap_info_struct *si, } /* Try reclaim full clusters if free and nonfull lists are drained */ - if (vm_swap_full()) + if (!swap_is_vswap(si) && vm_swap_full()) swap_reclaim_full_clusters(si, false); if (order < PMD_ORDER) { @@ -1465,7 +1486,8 @@ static void swap_range_alloc(struct swap_info_struct *si, if (vm_swap_full()) schedule_work(&si->reclaim_work); } - atomic_long_sub(nr_entries, &nr_swap_pages); + if (!swap_is_vswap(si)) + atomic_long_sub(nr_entries, &nr_swap_pages); } static void swap_range_free(struct swap_info_struct *si, unsigned long offset, @@ -1474,7 +1496,8 @@ static void swap_range_free(struct swap_info_struct *si, unsigned long offset, unsigned long end = offset + nr_entries - 1; void (*swap_slot_free_notify)(struct block_device *, unsigned long); - zswap_invalidate(si->type, offset, nr_entries); + if (!swap_is_vswap(si)) + zswap_invalidate(si->type, offset, nr_entries); if (si->flags & SWP_BLKDEV) swap_slot_free_notify = @@ -1493,7 +1516,8 @@ static void swap_range_free(struct swap_info_struct *si, unsigned long offset, * only after the above cleanups are done. */ smp_wmb(); - atomic_long_add(nr_entries, &nr_swap_pages); + if (!swap_is_vswap(si)) + atomic_long_add(nr_entries, &nr_swap_pages); swap_usage_sub(si, nr_entries); } @@ -1881,6 +1905,60 @@ static int swap_dup_entries_cluster(struct swap_info_struct *si, return err; } +static bool folio_may_vswap(struct folio *folio) +{ + struct obj_cgroup *objcg; + bool may_zswap; + + if (!vswap_is_enabled() || !zswap_is_enabled()) + return false; + + /* + * If zswap will not take the folio, writeout has to find a physical + * slot anyway. We are just incurring indirection overhead + * unnecessarily. + */ + objcg = get_obj_cgroup_from_folio(folio); + may_zswap = !objcg || obj_cgroup_may_zswap(objcg); + if (objcg) + obj_cgroup_put(objcg); + return may_zswap; +} + +static bool vswap_alloc(struct folio *folio) +{ + unsigned int order = folio_order(folio); + struct swap_cluster_info *ci; + unsigned long offset; + + local_lock(&percpu_vswap_cluster.lock); + offset = this_cpu_read(percpu_vswap_cluster.offset[order]); + + if (offset != SWAP_ENTRY_INVALID) { + ci = swap_cluster_lock(vswap_si, offset); + if (ci && cluster_is_usable(ci, order)) { + if (cluster_is_empty(ci)) + offset = cluster_offset(vswap_si, ci); + alloc_swap_scan_cluster(vswap_si, ci, folio, offset); + } else if (ci) { + swap_cluster_unlock(ci); + } + } + + if (!folio_test_swapcache(folio)) + cluster_alloc_swap_entry(vswap_si, folio); + + if (folio_test_swapcache(folio)) { + /* alloc_swap_scan_cluster updated percpu offset already */ + local_unlock(&percpu_vswap_cluster.lock); + return true; + } + + this_cpu_write(percpu_vswap_cluster.offset[order], SWAP_ENTRY_INVALID); + local_unlock(&percpu_vswap_cluster.lock); + return false; +} + /** * folio_alloc_swap - allocate swap space for a folio * @folio: folio we want to move to swap @@ -1897,10 +1975,13 @@ int folio_alloc_swap(struct folio *folio) { unsigned int order = folio_order(folio); unsigned int size = 1 << order; + bool may_vswap; VM_BUG_ON_FOLIO(!folio_test_locked(folio), folio); VM_BUG_ON_FOLIO(!folio_test_uptodate(folio), folio); + may_vswap = folio_may_vswap(folio); + if (order) { /* * Reject large allocation when THP_SWAP is disabled. Check below @@ -1919,12 +2000,16 @@ int folio_alloc_swap(struct folio *folio) } } + if (may_vswap && vswap_alloc(folio)) + goto done; + again: local_lock(&percpu_swap_cluster.lock); if (!swap_alloc_fast(folio)) swap_alloc_slow(folio); local_unlock(&percpu_swap_cluster.lock); +done: if (!order && unlikely(!folio_test_swapcache(folio))) { if (swap_sync_discard()) goto again; @@ -1942,7 +2027,7 @@ int folio_alloc_swap(struct folio *folio) return 0; failed: - if (get_nr_swap_pages() <= 0) + if (get_nr_swap_pages() <= 0 && !may_vswap) return -ENOSPC; if (mem_cgroup_get_folio_swap_margin(folio) <= 0) return -ENOMEM; -- 2.53.1-Meta