From patchwork Sun Dec 1 01:57:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 11268447 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6947A195A for ; Sun, 1 Dec 2019 01:57:19 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 36DEF205ED for ; Sun, 1 Dec 2019 01:57:19 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="O6MRrFdF" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 36DEF205ED Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 1FD276B036E; Sat, 30 Nov 2019 20:57:18 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 1D5BC6B0370; Sat, 30 Nov 2019 20:57:18 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 09D5B6B0371; Sat, 30 Nov 2019 20:57:18 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0054.hostedemail.com [216.40.44.54]) by kanga.kvack.org (Postfix) with ESMTP id E46706B036E for ; Sat, 30 Nov 2019 20:57:17 -0500 (EST) Received: from smtpin25.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with SMTP id 998EA180AD817 for ; Sun, 1 Dec 2019 01:57:17 +0000 (UTC) X-FDA: 76214910114.25.time65_3fa6390f1731b X-Spam-Summary: 2,0,0,17124e4a2afd7e2d,d41d8cd98f00b204,akpm@linux-foundation.org,:akpm@linux-foundation.org:kirill.shutemov@linux.intel.com:kirill@shutemov.name::mhocko@kernel.org:mm-commits@vger.kernel.org:torvalds@linux-foundation.org:yang.shi@linux.alibaba.com,RULES_HIT:41:355:379:800:960:966:967:968:973:988:989:1260:1263:1345:1381:1431:1437:1534:1541:1711:1730:1747:1777:1792:2196:2199:2393:2525:2559:2563:2682:2685:2859:2902:2933:2937:2939:2942:2945:2947:2951:2954:3022:3138:3139:3140:3141:3142:3353:3865:3866:3867:3868:3871:3934:3936:3938:3941:3944:3947:3950:3953:3956:3959:4321:4385:5007:6261:6653:7576:7903:8599:8957:9025:9545:10004:10913:11026:11473:11658:11914:12043:12048:12297:12438:12517:12519:12555:12679:12783:12986:13069:13161:13229:13311:13357:14181:14384:14721:14849:21060:21080:21451:21627:21939:30054:30070,0,RBL:error,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:4,LUA_SUMMARY:none X-HE-Tag: time65_3fa6390f1731b X-Filterd-Recvd-Size: 3029 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf42.hostedemail.com (Postfix) with ESMTP for ; Sun, 1 Dec 2019 01:57:17 +0000 (UTC) Received: from localhost.localdomain (c-73-231-172-41.hsd1.ca.comcast.net [73.231.172.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E5FEA20873; Sun, 1 Dec 2019 01:57:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1575165436; bh=GkZ0k2Q12lDqrJYbxGBpJ394Oqy+QeZOEOYWxn8aoMo=; h=Date:From:To:Subject:From; b=O6MRrFdF6R+06GtgZ+oD2pIVxgpPNHTUXQoEw4xzeNa3WejHcboGZEtomHEHic9RU qiUxDZXaEgx+GHkVoOxQcJNWp4K4ZJ5JI9XgFXlypgslPpgX9KxDq2rEMb8f/VSG1X JOYo+ZV3W50wX1WTQPyuJQfAiN4fH5uP1wlS/WCU= Date: Sat, 30 Nov 2019 17:57:15 -0800 From: akpm@linux-foundation.org To: akpm@linux-foundation.org, kirill.shutemov@linux.intel.com, kirill@shutemov.name, linux-mm@kvack.org, mhocko@kernel.org, mm-commits@vger.kernel.org, torvalds@linux-foundation.org, yang.shi@linux.alibaba.com Subject: [patch 135/158] mm, thp: do not queue fully unmapped pages for deferred split Message-ID: <20191201015715.7Go-jCWUJ%akpm@linux-foundation.org> User-Agent: s-nail v14.8.16 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: From: "Kirill A. Shutemov" Subject: mm, thp: do not queue fully unmapped pages for deferred split Adding fully unmapped pages into deferred split queue is not productive: these pages are about to be freed or they are pinned and cannot be split anyway. Link: http://lkml.kernel.org/r/20190913091849.11151-1-kirill.shutemov@linux.intel.com Signed-off-by: Kirill A. Shutemov Reviewed-by: Yang Shi Cc: Michal Hocko Signed-off-by: Andrew Morton --- mm/rmap.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) --- a/mm/rmap.c~mm-thp-do-not-queue-fully-unmapped-pages-for-deferred-split +++ a/mm/rmap.c @@ -1292,12 +1292,20 @@ static void page_remove_anon_compound_rm if (TestClearPageDoubleMap(page)) { /* * Subpages can be mapped with PTEs too. Check how many of - * themi are still mapped. + * them are still mapped. */ for (i = 0, nr = 0; i < HPAGE_PMD_NR; i++) { if (atomic_add_negative(-1, &page[i]._mapcount)) nr++; } + + /* + * Queue the page for deferred split if at least one small + * page of the compound page is unmapped, but at least one + * small page is still mapped. + */ + if (nr && nr < HPAGE_PMD_NR) + deferred_split_huge_page(page); } else { nr = HPAGE_PMD_NR; } @@ -1305,10 +1313,8 @@ static void page_remove_anon_compound_rm if (unlikely(PageMlocked(page))) clear_page_mlock(page); - if (nr) { + if (nr) __mod_node_page_state(page_pgdat(page), NR_ANON_MAPPED, -nr); - deferred_split_huge_page(page); - } } /**