From patchwork Thu Jul 4 11:24:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baolin Wang X-Patchwork-Id: 13723633 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 72EFAC30653 for ; Thu, 4 Jul 2024 11:25:20 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6D65C6B00A4; Thu, 4 Jul 2024 07:25:16 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 63A606B00C1; Thu, 4 Jul 2024 07:25:16 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 090C96B00A4; Thu, 4 Jul 2024 07:25:16 -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 D394C6B00B3 for ; Thu, 4 Jul 2024 07:25:15 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 8FBC5A3729 for ; Thu, 4 Jul 2024 11:25:15 +0000 (UTC) X-FDA: 82301838990.22.BBA72B9 Received: from out30-101.freemail.mail.aliyun.com (out30-101.freemail.mail.aliyun.com [115.124.30.101]) by imf07.hostedemail.com (Postfix) with ESMTP id 5424A4000E for ; Thu, 4 Jul 2024 11:25:12 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=linux.alibaba.com header.s=default header.b=nHMzrB0X; spf=pass (imf07.hostedemail.com: domain of baolin.wang@linux.alibaba.com designates 115.124.30.101 as permitted sender) smtp.mailfrom=baolin.wang@linux.alibaba.com; dmarc=pass (policy=none) header.from=linux.alibaba.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1720092281; 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=gnvmYA2eSyc6bAhukdfnEGSceMWwrl4WSlzxAF32JnQ=; b=X+DMIsnHqSe4JuLOg+4+V6Sw1wy1u1+VKgCibZqTDj7bPq3ixkbZqsNQ9qvdNt08TQahFr 3ckQI0BIaJNRC3hm2TXDMqi3kvBiE4cAVhwfZxAHoMDhr4HG/e67KC6Ri/wvOcC4qELWl6 iNaE3Wc0o7uJUqpHVrFNiJro1sztfoc= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=linux.alibaba.com header.s=default header.b=nHMzrB0X; spf=pass (imf07.hostedemail.com: domain of baolin.wang@linux.alibaba.com designates 115.124.30.101 as permitted sender) smtp.mailfrom=baolin.wang@linux.alibaba.com; dmarc=pass (policy=none) header.from=linux.alibaba.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1720092281; a=rsa-sha256; cv=none; b=ILl7HO2axcorfCeO17D52cUfKNTj8rvF9Qnqfdn9kqm9PWJrancP8NOf3Sl4hspiEQXEnH oBDK9SzZyc54J2oE+JVjnYXcgFvbBl6YN4O/A8w7zr13IJdOl1bitUO7o51QGdi6TX0TxI GLt21G4uQdp25Hpk1vAJHRYEWDu6Vv4= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1720092309; h=From:To:Subject:Date:Message-Id:MIME-Version; bh=gnvmYA2eSyc6bAhukdfnEGSceMWwrl4WSlzxAF32JnQ=; b=nHMzrB0XAjd+FBvoo7NibQk5kHFIBPF4dPo2L0Esrf4ixMAvf6uMcCxfI22r162O0Da+h68QJC0sGU8d1QTwj41yQWRkXFRmij/Nnn3zM+TorHbmFKUcus8EfE/NjAqARP5aX8LaYo1DQ8EyrmWprM1sh8oauaS7FJNToZIS/oE= X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R101e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=maildocker-contentspam033037067110;MF=baolin.wang@linux.alibaba.com;NM=1;PH=DS;RN=17;SR=0;TI=SMTPD_---0W9qjOw7_1720092308; Received: from localhost(mailfrom:baolin.wang@linux.alibaba.com fp:SMTPD_---0W9qjOw7_1720092308) by smtp.aliyun-inc.com; Thu, 04 Jul 2024 19:25:08 +0800 From: Baolin Wang To: akpm@linux-foundation.org, hughd@google.com Cc: willy@infradead.org, david@redhat.com, wangkefeng.wang@huawei.com, chrisl@kernel.org, ying.huang@intel.com, 21cnbao@gmail.com, ryan.roberts@arm.com, shy828301@gmail.com, ziy@nvidia.com, ioworker0@gmail.com, da.gomez@samsung.com, p.raghav@samsung.com, baolin.wang@linux.alibaba.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 01/10] mm: vmscan: add validation before spliting shmem large folio Date: Thu, 4 Jul 2024 19:24:50 +0800 Message-Id: X-Mailer: git-send-email 2.39.3 In-Reply-To: References: MIME-Version: 1.0 X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 5424A4000E X-Stat-Signature: a9o7akfxesxo8zynb16r8upyf41f9yzu X-Rspam-User: X-HE-Tag: 1720092312-738842 X-HE-Meta: U2FsdGVkX18miM2aE1UKorgk8XpLsvP0eGg9PLhpcfN11jBE6m9ngVjpgiJg8G4j6mjaUF3gK2MjoIVmjg6M9X+kNWCCMiLYbFniQYqMZNSCW3ol3+pQGoa3siNSDeMIIjOqN2b8EE/8AzQ2ZqtNt/GDrB8VLzRF9ht8iZJQjIrnBm5P5fuMp0Jh1jK6fja+pM9pmbSsnIhD+0C7jQtMHwhJhTCji65w/Ci83x+Hh1lPim35Slcl5p/ak/eFcwW3UJFmDpmU+NHP8gedX4xIkA1jaS9Bc5Mr5+NLD9ecl4mEa1PIBFt7gE+Ci4FIIHMQc+rrC5nziWaSKAIZUA+jfULpx1XAhu/0OQWTg/zZp+YW1xYYra0x9jgWpwMv9EMAQXT5hKUnRs7tKZp9dt9ERjoFPrEaV12u5/uLmLVRTuq5ZsNVNsqQfmmSKgbHRdQSeNeupxDZGN0Kdjzyo+yhUSLwDj0+7tl2Erdzkr+VHXQ0Cpr1iSZLlqEKxHoRS9mO4hWyA/6RXO9GK4VbtkTyRQ4nKK760AkJV0sVRvirEauCU/4JY7SyS61DGQ31F/7XXHR/c87s6f3YzuWr5OtwgKcMtDT6mrH87IDif7C9VuVlV1NmsFxw/Tt4Rv6lzstVnv5akfwzQAm5v8udVVrBrusvKGovZgA2ZoFhk0i4+l0bs5K8G+dbFVgO/peKyQ3m0TjFxyXFh7omIImQenGJpQ0e4BO7r2KlotW+Ye8UCzIT2z+5MUKZkJ7Ra9Gd3Fe7pDM58QH7kUMgbPm/P/ei/6w9r/UhRfXy+UaH7sVfl+mhOaPL4G7iyKkXasLqJG+GF8FMkyqvGGtX9A+exZjSjPexk2YQzwZj/A4QXvnKTstMkMq7FA5Kbh99TOdQPhg0APKvqTG9SaWtBbIehky3OfDf77RIPP4pBTrh5QiVjieDEWr6HL50x4Bwn8GImglSwjcpw9DRlxZ+rPL9zrv nspXx0Fd 73q1wuwnZv3DWx0gaAVKRzhy6JmmWrLfitZCvyhitAR3kXbxfZ7uM02c33LAiuLJvslPRm0qzN5pnbeZgjVUolDhd4n9xTaWgmp+kiGP4Zf3HKaS3qR+7iBeUVB5ViVj031eBnK2NuGpUwaMDZkm0p+ohmd+2zu02yvWoGKsmZIkqInKXSnHfgJEPcj6jiqj5hjrRNJiytgqvhy/iRjqu/QF7t+cKB02+Dv9+WzXSoqtgICk1HC0uBMVANYciuhdQRZKjZtw99E67Ryc= 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: Page reclaim will not scan anon LRU if no swap space, however MADV_PAGEOUT can still split shmem large folios even without a swap device. Thus add swap available space validation before spliting shmem large folio to avoid redundant split. Signed-off-by: Baolin Wang --- mm/vmscan.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/mm/vmscan.c b/mm/vmscan.c index 1807e5d95dda..61465f92283f 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -1237,6 +1237,14 @@ static unsigned int shrink_folio_list(struct list_head *folio_list, } } else if (folio_test_swapbacked(folio) && folio_test_large(folio)) { + + /* + * Do not split shmem folio if no swap memory + * available. + */ + if (!total_swap_pages) + goto activate_locked; + /* Split shmem folio */ if (split_folio_to_list(folio, folio_list)) goto keep_locked;