From patchwork Fri Mar 27 17:05:56 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: 11462705 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 5DC86913 for ; Fri, 27 Mar 2020 17:06:12 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 28D9B206F2 for ; Fri, 27 Mar 2020 17:06:12 +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="pqPZ+KnQ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 28D9B206F2 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 D64E96B000E; Fri, 27 Mar 2020 13:06:06 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id CC6F86B006E; Fri, 27 Mar 2020 13:06:06 -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 B3F246B0070; Fri, 27 Mar 2020 13:06:06 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0121.hostedemail.com [216.40.44.121]) by kanga.kvack.org (Postfix) with ESMTP id 6FE2A6B000E for ; Fri, 27 Mar 2020 13:06:06 -0400 (EDT) Received: from smtpin22.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 5872E6103 for ; Fri, 27 Mar 2020 17:06:06 +0000 (UTC) X-FDA: 76641769932.22.land38_6f7625d227922 X-Spam-Summary: 2,0,0,5643b8ea05960c13,d41d8cd98f00b204,kirill@shutemov.name,,RULES_HIT:41:355:379:541: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:30003:30034:30054:30070,0,RBL:209.85.208.194:@shutemov.name:.lbl8.mailshell.net-66.201.201.201 62.8.0.100,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:24,LUA_SUMMARY:none X-HE-Tag: land38_6f7625d227922 X-Filterd-Recvd-Size: 4338 Received: from mail-lj1-f194.google.com (mail-lj1-f194.google.com [209.85.208.194]) by imf12.hostedemail.com (Postfix) with ESMTP for ; Fri, 27 Mar 2020 17:06:05 +0000 (UTC) Received: by mail-lj1-f194.google.com with SMTP id g27so10922648ljn.10 for ; Fri, 27 Mar 2020 10:06:05 -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=Fw/iy6xjbd/Vbu7hIqNLPaVOpy/RK+By1QJ7syGCyKw=; b=pqPZ+KnQrKyd6FiKwsInKAWqhn2zXakFKwgrm9nzLBgFus1py3Iu2UO8q6Qx1MQ6+C e8Ejg39nuKDg9y06gDkoTBO9VJJ4QW4vH2JXjX9tkq3eYlJN5MzXHZG2HDwpxJaG9oLV +1gbfeTURUHlkt1jQlO6qZPrpP5TnwfKGAH1BDJOhJ5qiTlotjonDqsfcZ205isYssHd RXb7QKpee++7GHCpH53vyhFQ/Hanp/zRWwJgCSmWLbZy6TW3aAQqvNaZWFb8I4dUEFdF PpJCf/z6u1OGEnuXJRcCchYi5/AuZPs+FQk0gQBGH+PnjeWKCzfLhnK7BUUuJkboh7LO Ficw== 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=Fw/iy6xjbd/Vbu7hIqNLPaVOpy/RK+By1QJ7syGCyKw=; b=X2YDezz2roFgL0t6VMgbzeuYqOS5e1f5vx474jBSgI9HuS1kYuPD8IKnUd36KusaVh jEfoO2QE/w5rhH+1bnH0yfK6T11iMVZoWtaDfIamcZRBBcJYnDWx8uCjBDeaB/0kHVKw s9WMV/irFUxam9VdT0g8zaYrWh1PzswJ6hDQSbM482/T/UY5BlnUI4S+KA3aShQ0d5il 6K1Iu0Q9Edp8KwVvo/3Fk/g0PjIKxYUn+46Z4FDAgdwL4n9Da2tbgHOlBv0la7kXGJ+p bM3C2EsAKDaxG47G011Yoacb4z2pa1xnvMVh9MCLw4aJvf3JpxaGxew3j/G/MZAZWJej 0kRA== X-Gm-Message-State: AGi0PuYHdm75KP7Utbbs1R8CYsAJqPxesKWwtoxcPF77yhi/wHuV5OXh 7sBtLaYb9mkP3mYGULqeGsWwPclWjAE= X-Google-Smtp-Source: ADFU+vvdqlE5S6Ml34ZpWzMm9diRAgh8m5sJC5LUbAaWxqKa8rxqiLVwiLIVGcpzhADb4m0kD666Zg== X-Received: by 2002:a05:651c:515:: with SMTP id o21mr9232046ljp.91.1585328764152; Fri, 27 Mar 2020 10:06:04 -0700 (PDT) Received: from box.localdomain ([86.57.175.117]) by smtp.gmail.com with ESMTPSA id y20sm2967120ljy.100.2020.03.27.10.06.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Mar 2020 10:06:03 -0700 (PDT) From: "Kirill A. Shutemov" X-Google-Original-From: "Kirill A. Shutemov" Received: by box.localdomain (Postfix, from userid 1000) id 62ED8100D27; Fri, 27 Mar 2020 20:06:07 +0300 (+03) To: akpm@linux-foundation.org, Andrea Arcangeli Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, "Kirill A. Shutemov" Subject: [PATCH 2/7] khugepaged: Do not stop collapse if less than half PTEs are referenced Date: Fri, 27 Mar 2020 20:05:56 +0300 Message-Id: <20200327170601.18563-3-kirill.shutemov@linux.intel.com> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200327170601.18563-1-kirill.shutemov@linux.intel.com> References: <20200327170601.18563-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 refereced 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 --- 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;