From patchwork Wed Jun 22 17:06:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miaohe Lin X-Patchwork-Id: 12891175 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 0B665CCA481 for ; Wed, 22 Jun 2022 17:07:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7D40A6B00CF; Wed, 22 Jun 2022 13:06:53 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 71A0A8E00D3; Wed, 22 Jun 2022 13:06:53 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 31BE76B00CF; Wed, 22 Jun 2022 13:06:53 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id E70506B00D4 for ; Wed, 22 Jun 2022 13:06:52 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id B8C416140E for ; Wed, 22 Jun 2022 17:06:52 +0000 (UTC) X-FDA: 79606501464.16.1AD9F39 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by imf11.hostedemail.com (Postfix) with ESMTP id 0F17E400B4 for ; Wed, 22 Jun 2022 17:06:49 +0000 (UTC) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.53]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4LSqXR1nM0zDrGg; Thu, 23 Jun 2022 01:05:59 +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; Thu, 23 Jun 2022 01:06:32 +0800 From: Miaohe Lin To: CC: , , , , , Subject: [PATCH 11/16] mm/huge_memory: try to free subpage in swapcache when possible Date: Thu, 23 Jun 2022 01:06:22 +0800 Message-ID: <20220622170627.19786-12-linmiaohe@huawei.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20220622170627.19786-1-linmiaohe@huawei.com> References: <20220622170627.19786-1-linmiaohe@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.124.27] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=none; spf=pass (imf11.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.189 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1655917610; 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=BYGhDF/tmNqTlx2C88YLNUW3r/aPC526LMz+sx+oJw0=; b=yB+FVp2I6BErannczM7V3hSOwYqDItOwED9c53x5inwO8K/cArhohlfQJEE4qH1ZhF+rxO t671rv1t6api4+etm41h7YEOX0XNXJdOazmuIvNRFTNR1a+wiGKfh2LNEcYw6YV3vNJrXe tTSanX49mANilD1uPX7iMefL421SrJc= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1655917610; a=rsa-sha256; cv=none; b=R++5Svz8KsMsw0C9BN7Ns7LW9Uaoupg+kEMWeGVvvjT5SftAfIHsS8qSHg+WqNFu8ZTe1f 3ha74KSH5l7SIPgEuQKYxwwMi9IqTnA2kGuSEiQ6NO4ZXuJrSaMT+MpV/PMFJdKiF27eQu alMr9XmoPJ9ZB7HXaSo8LWmnu6Aagao= X-Rspamd-Server: rspam11 X-Rspamd-Queue-Id: 0F17E400B4 X-Rspam-User: Authentication-Results: imf11.hostedemail.com; dkim=none; spf=pass (imf11.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.189 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com X-Stat-Signature: xuezf6gp5hegjrkg9qhfpkufxmh6izba X-HE-Tag: 1655917609-253190 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 fd12fa930937..506e7a682780 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -2539,7 +2539,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); } }