From patchwork Fri Apr 3 11:29:24 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: 11472559 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 DD17914DD for ; Fri, 3 Apr 2020 11:29:40 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id A99602073B for ; Fri, 3 Apr 2020 11:29:40 +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="x0yHw6L/" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A99602073B 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 8D1E78E000C; 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 833208E000B; 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 6AFE98E000A; 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 (smtprelay0038.hostedemail.com [216.40.44.38]) by kanga.kvack.org (Postfix) with ESMTP id 2FF158E0007 for ; Fri, 3 Apr 2020 07:29:37 -0400 (EDT) Received: from smtpin23.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id E5047180AD804 for ; Fri, 3 Apr 2020 11:29:36 +0000 (UTC) X-FDA: 76666323552.23.coach44_36c74ccc96c07 X-Spam-Summary: 2,0,0,8d3fa67fb637167d,d41d8cd98f00b204,kirill@shutemov.name,,RULES_HIT:41:355:379:541:960:968:973:988:989:1260:1311:1314:1345:1359:1437:1515:1534:1540:1711:1730:1747:1777:1792:2393:2553:2559:2562:3138:3139:3140:3141:3142:3352:3608:3865:3867:3870:3872:4250:5007:6261:6653:10004:11026:11658:11914:12043:12296:12297:12438:12517:12519:12555:12895:13069:13311:13357:13894:14096:14181:14384:14394:14721:21080:21444:21451:21627:21990:30054:30090,0,RBL:209.85.167.49:@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:25,LUA_SUMMARY:none X-HE-Tag: coach44_36c74ccc96c07 X-Filterd-Recvd-Size: 4134 Received: from mail-lf1-f49.google.com (mail-lf1-f49.google.com [209.85.167.49]) by imf39.hostedemail.com (Postfix) with ESMTP for ; Fri, 3 Apr 2020 11:29:36 +0000 (UTC) Received: by mail-lf1-f49.google.com with SMTP id e7so5511936lfq.1 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=mAGZx/EGSI/RDjikjycvglo1xEb2tWim3LCqQGVnzJI=; b=x0yHw6L/NgJHQg6clxAQ3NicETBimmrGkxc5bhLtUTHIZZ6gdjrI89zcBBRayGoUir 7ufdkT4qvJVe+kOZvQbza2ILOMRGvZLR8jyJ1EKVJVN5VePrJVVG9hKMEjkhfUj+6p30 cm6cVLDe1QxBjGcUYoMnxWjf3bfLuxj/jPNPguI1Akb5WzqU3t+fnrXihgwP/ppUph4A CT3L4rtI5GFKkmcmzxY7uLbnZDFQfWFqto6O/7V/qNfsjFmHmj+ow7Eikvk0jTBposlE HYt7MTTbT/vjnMgOVp6OtXYFrpQClrjVosE22wjvOGPykQyxB03RFBVO3UNwtMK4WO/z GT6g== 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=mAGZx/EGSI/RDjikjycvglo1xEb2tWim3LCqQGVnzJI=; b=QNxTWmzbTvRYWRkmEcRPduObglMjTcMBZJEDIGcHwx11fuvl+lz6B1Z/6CKlEPLGgL s4J+8VCNp09iBBo5hAcMzkk7J4bV8pkB7aXyFuXYjyBkkH4CzuPbTgonuJcgYW1YB6Jh TInNUwIaAuMkreLggWvWdpngW1e7ohd4Qj5VSkMGzrrIcUOkC1+x8JPWlL6y17/PQuG8 zOZR4AdjLYTHqpZ6bPZHwmnlxQam2DAxyUAyfR3JIgiYg27l61lMUi+TYo3AK8n2dCw8 hdhhyYeMrMBHtAd2zgID+WuhZe73PpyiLsFPkKGecLLYKn/CzFip92yYMU9L7+9+G+vB KQ+A== X-Gm-Message-State: AGi0PuaUCVwUkyZ3dsz0VoMGji22T94XM959nwizKr2HQ2oH9Xg0lvQ9 18/qtzupqIdaiT/30P2cdoQjIfGrXGo= X-Google-Smtp-Source: APiQypJP33b4u4UTOhlDU6gSnxe16ao8dSUMHIdTs8YvwSZz48wsEnm0lTloLTHHu7PruzVkkB7nSQ== X-Received: by 2002:a05:6512:14a:: with SMTP id m10mr688758lfo.152.1585913374487; Fri, 03 Apr 2020 04:29:34 -0700 (PDT) Received: from box.localdomain ([86.57.175.117]) by smtp.gmail.com with ESMTPSA id p14sm3202760lfe.87.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 78D6B101332; 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 4/8] khugepaged: Drain LRU add pagevec after swapin Date: Fri, 3 Apr 2020 14:29:24 +0300 Message-Id: <20200403112928.19742-5-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_isolate() may fail due to extra pin in the LRU add pagevec. It's petty common for swapin case: we swap in pages just to fail due to the extra pin. Drain LRU add pagevec on sucessfull swapin. Signed-off-by: Kirill A. Shutemov --- mm/khugepaged.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/mm/khugepaged.c b/mm/khugepaged.c index fdc10ffde1ca..57ff287caf6b 100644 --- a/mm/khugepaged.c +++ b/mm/khugepaged.c @@ -940,6 +940,11 @@ static bool __collapse_huge_page_swapin(struct mm_struct *mm, } vmf.pte--; pte_unmap(vmf.pte); + + /* Drain LRU add pagevec to remove extra pin on the swapped in pages */ + if (swapped_in) + lru_add_drain(); + trace_mm_collapse_huge_page_swapin(mm, swapped_in, referenced, 1); return true; }