From patchwork Fri Apr 3 11:29:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kirill A. Shutemov" X-Patchwork-Id: 11472563 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 C9A511667 for ; Fri, 3 Apr 2020 11:29:45 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 95F0A20BED for ; Fri, 3 Apr 2020 11:29:45 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=shutemov-name.20150623.gappssmtp.com header.i=@shutemov-name.20150623.gappssmtp.com header.b="K/3jDpUj" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 95F0A20BED Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=shutemov.name Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id EC5568E000B; Fri, 3 Apr 2020 07:29:37 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id E74B38E0007; Fri, 3 Apr 2020 07:29:37 -0400 (EDT) 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 D42028E000B; Fri, 3 Apr 2020 07:29:37 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0050.hostedemail.com [216.40.44.50]) by kanga.kvack.org (Postfix) with ESMTP id AC6F38E0007 for ; Fri, 3 Apr 2020 07:29:37 -0400 (EDT) Received: from smtpin12.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 6234F40C3 for ; Fri, 3 Apr 2020 11:29:37 +0000 (UTC) X-FDA: 76666323594.12.tray00_36d17eda7a453 X-Spam-Summary: 2,0,0,7b62ce83062f3f5b,d41d8cd98f00b204,kirill@shutemov.name,,RULES_HIT:41:355:379:541:800:960:973:988:989:1260:1311:1314:1345:1359:1437:1515:1534:1541:1711:1730:1747:1777:1792:2393:2559:2562:3138:3139:3140:3141:3142:3352:3608:3865:3866:3867:3870:3871:3872:3874:4250:4321:5007:6261:6653:10004:11026:11473:11658:11914:12043:12296:12297:12438:12517:12519:12555:12679:12895:12986:13069:13161:13229:13255:13311:13357:13894:14096:14181:14384:14394:14721:21080:21433:21444:21451:21627:21990,0,RBL:209.85.208.194:@shutemov.name:.lbl8.mailshell.net-62.8.0.100 66.201.201.201,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:105,LUA_SUMMARY:none X-HE-Tag: tray00_36d17eda7a453 X-Filterd-Recvd-Size: 4440 Received: from mail-lj1-f194.google.com (mail-lj1-f194.google.com [209.85.208.194]) by imf08.hostedemail.com (Postfix) with ESMTP for ; Fri, 3 Apr 2020 11:29:36 +0000 (UTC) Received: by mail-lj1-f194.google.com with SMTP id k21so6611242ljh.2 for ; Fri, 03 Apr 2020 04:29:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=shutemov-name.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=5yEswaSUA2DH71ZsH03UY5693O0nZ/nvg6oBTomxklk=; b=K/3jDpUjVVBeQnEhKWwM3gy5Gru8BoX47Ll9axoy1+xsPYklIrCBMX+fynu8VQkirs c7IdaWFPcUAldS81Lgl8ts8UDyFmKK3wuwf482yQ5bwzcLTPPeeEmvb5bjZbaEtS5n1J 980tEnkeEIMw580fqyrxQAJGlI8ZBc5u0zbNRGkxjEdap7yl1DDi31Sve1b1iRjJtidt K8hYew8M8h7Y4uEk48knMl1An7JC3fl1k9m7z60tTErq8ZJXAOHVNOwOCMj5aGJsNKBT INczse/l8Bw4CLc8ed/WJp0e/iooX+2Y+2EaKM3rsCunrr9NUn1zbLDKNy1WRvbv8m7S GWow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=5yEswaSUA2DH71ZsH03UY5693O0nZ/nvg6oBTomxklk=; b=MKFnuvyRnQykbSFYfppZEllLDWQYieQzmcefVb4kAHgoZ+SPeW2wxIVRMpacPM/ulp 0n37tlDb7Ri6wqvtxSM9/KPfa9JV42d120rqwCi9h723GxppFdMdo40wK5EZS0kPUnyJ 27qwUyf9sYvr/BbAM1IxakLv7IjGllD11La1oBic9ikXPfOxoA8zm3ryiGN2ooqSiSty 2e3KaFolRk5xV4a1/ZRRHqTA3UdbMpwTIaZp/Exb0hYm+PiDu9+0eO8CnqGvuzuVi/s7 pX0j5BB5hxM30OxAoqsyonCJVIKIUcG+Icd7CNSnK7ITlBHuMUuP1Z1DEzRVKNl6kiCK JzaA== X-Gm-Message-State: AGi0PuboF50cug1QslnkcsrdOw8WXgDkesMX6qTf7/feKcT71vDKuT5W 6jshoDTsmljU7Nl5i7QdtM/aPz7mTy0= X-Google-Smtp-Source: APiQypKvudeHPoFOkTLttn1XgRDx3Ffmfb4xTNZsju3O5Jb2cdvCtz/BcvwoJutkC4kvL/iz3qhYPw== X-Received: by 2002:a2e:9718:: with SMTP id r24mr4294536lji.287.1585913374778; Fri, 03 Apr 2020 04:29:34 -0700 (PDT) Received: from box.localdomain ([86.57.175.117]) by smtp.gmail.com with ESMTPSA id j2sm5765073lfh.70.2020.04.03.04.29.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Apr 2020 04:29:33 -0700 (PDT) From: "Kirill A. Shutemov" X-Google-Original-From: "Kirill A. Shutemov" Received: by box.localdomain (Postfix, from userid 1000) id 6B64E101330; Fri, 3 Apr 2020 14:29:31 +0300 (+03) To: akpm@linux-foundation.org, Andrea Arcangeli Cc: Zi Yan , Yang Shi , linux-mm@kvack.org, linux-kernel@vger.kernel.org, "Kirill A. Shutemov" Subject: [PATCHv2 2/8] khugepaged: Do not stop collapse if less than half PTEs are referenced Date: Fri, 3 Apr 2020 14:29:22 +0300 Message-Id: <20200403112928.19742-3-kirill.shutemov@linux.intel.com> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200403112928.19742-1-kirill.shutemov@linux.intel.com> References: <20200403112928.19742-1-kirill.shutemov@linux.intel.com> MIME-Version: 1.0 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: __collapse_huge_page_swapin() check number of referenced PTE to decide if the memory range is hot enough to justify swapin. The problem is that it stops collapse altogether if there's not enough referenced pages, not only swappingin. Signed-off-by: Kirill A. Shutemov Fixes: 0db501f7a34c ("mm, thp: convert from optimistic swapin collapsing to conservative") Reviewed-by: Zi Yan Acked-by: Yang Shi --- mm/khugepaged.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mm/khugepaged.c b/mm/khugepaged.c index 99bab7e4d05b..14d7afc90786 100644 --- a/mm/khugepaged.c +++ b/mm/khugepaged.c @@ -905,7 +905,8 @@ static bool __collapse_huge_page_swapin(struct mm_struct *mm, /* we only decide to swapin, if there is enough young ptes */ if (referenced < HPAGE_PMD_NR/2) { trace_mm_collapse_huge_page_swapin(mm, swapped_in, referenced, 0); - return false; + /* Do not block collapse, only skip swapping in */ + return true; } vmf.pte = pte_offset_map(pmd, address); for (; vmf.address < address + HPAGE_PMD_NR*PAGE_SIZE;