From patchwork Tue Jun 28 13:28:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miaohe Lin X-Patchwork-Id: 12898294 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 EAD8EC433EF for ; Tue, 28 Jun 2022 13:28:54 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D56BE8E0007; Tue, 28 Jun 2022 09:28:48 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BEA6D8E000B; Tue, 28 Jun 2022 09:28:48 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 77F6D8E0007; Tue, 28 Jun 2022 09:28:48 -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 5706E8E0009 for ; Tue, 28 Jun 2022 09:28:48 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay13.hostedemail.com (Postfix) with ESMTP id B12DC60762 for ; Tue, 28 Jun 2022 13:28:47 +0000 (UTC) X-FDA: 79627724694.20.52190E6 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf25.hostedemail.com (Postfix) with ESMTP id 51596A003D for ; Tue, 28 Jun 2022 13:28:46 +0000 (UTC) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4LXQPS5w0YzkX1h; Tue, 28 Jun 2022 21:27:24 +0800 (CST) Received: from huawei.com (10.175.124.27) by canpemm500002.china.huawei.com (7.192.104.244) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Tue, 28 Jun 2022 21:28:43 +0800 From: Miaohe Lin To: CC: , , , , , , Subject: [PATCH v2 11/16] mm/huge_memory: try to free subpage in swapcache when possible Date: Tue, 28 Jun 2022 21:28:30 +0800 Message-ID: <20220628132835.8925-12-linmiaohe@huawei.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20220628132835.8925-1-linmiaohe@huawei.com> References: <20220628132835.8925-1-linmiaohe@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.124.27] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1656422927; 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-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=z/KWpKxhovlvl8821GirzUIvgllp109XeOztU+qtPrg=; b=R7JbcKKRXizXLGxtk9/3mxLDG5vvapaF1RK2nKTq/7JoJ/wuLsBUnziQej3o/V02JTbcXr fUxpd8p8l1LieBrUyWO1cN1x4jNMowHALqacbMwG2dhiYdqp7XDNi15mhX3C1W6oDLbJv1 gu1jtr5GLsOrib+I4WXA5FMMtr+w9VY= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=none; spf=pass (imf25.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1656422927; a=rsa-sha256; cv=none; b=8mgwYDTKSXrzGzlQ9XSdihnmBxBCrgnxnvM0KvVZO6bw1h82cB7LVk/IAhuYWeyMTb7h4p UHqQOhVIBS7Y1uFmbrj0DCQfAST47D5/pXnZmH03BTWFIGMESdmcXFT2TWt2yIaoqWujlE y74hWVPR7RM3pw02+e5PgP3xlZCv01U= Authentication-Results: imf25.hostedemail.com; dkim=none; spf=pass (imf25.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com X-Rspam-User: X-Rspamd-Server: rspam06 X-Stat-Signature: mo1hyxqkrwa7dmz8jixcsk3kdtjmbgqe X-Rspamd-Queue-Id: 51596A003D X-HE-Tag: 1656422926-544803 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: Subpages in swapcache won't be freed even if it is the last user of the page until next time reclaim. It shouldn't hurt indeed, but we could try to free these pages to save more memory for system. Signed-off-by: Miaohe Lin --- mm/huge_memory.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/huge_memory.c b/mm/huge_memory.c index b0fc3c560245..bded58ada414 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -2638,7 +2638,7 @@ static void __split_huge_page(struct page *page, struct list_head *list, * requires taking the lru_lock so we do the put_page * of the tail pages after the split is complete. */ - put_page(subpage); + free_page_and_swap_cache(subpage); } }