Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp3587487ybb; Mon, 6 Apr 2020 11:31:41 -0700 (PDT) X-Google-Smtp-Source: APiQypKNMTb6YqicAyx/OF60qDhDkaZCTaAVZjYSstSwQXfXaMW0QU4rVPFp6MtWo/WEBYrNlNlb X-Received: by 2002:a05:6830:2428:: with SMTP id k8mr19211136ots.345.1586197901421; Mon, 06 Apr 2020 11:31:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586197901; cv=none; d=google.com; s=arc-20160816; b=Lf5veW5x/pIFNVAVT3XXyK9iNe0HbRBPzIWb5CyrKnFmDKuwm3PCfccAgaMbzqy+AU xRlBI4Ov6CQsoOXzpy+VH2Okhq79ModdmGtf0lUxk8iCy/alPylQ37w8OmkYN3aU5caY qyq//LAq0FavrluNmOFydwtQonkGGf/+RhsSFOjOV+2DNOdoLVHdq9wEq6NPP7yBe3I5 /7Ob6wNKC0CBeaI+eBWIuW4I1T5q7i6rVE6cfXo0LFjTpxMrtXdqQ8LxhxpRPtIU4hnQ nsKuYx+pgzfI/7f0QBsau+UXviEEzDexxQ/07YLAkXu8GNyp5iH3oXTB+gIBrMi4YY01 FbOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=L3aflnnhQnp9rkeog4zG5/NhAJkxg9sHdZgja5i/tRw=; b=ZLS9j+OrXplcwR1KIf/qXLQrHNeuFgv2NUabZHgiwbFOlP52o4TXcqcQZMLfNJ2G6Z 5wmr5LTIPC+bEjgDkmv+4t2+vn1kuEwCOjn7VxnkH5kNI7mJrdJKfDn16t/0K2eud1YY i7Oe0l9nc9Um9k9NI4QqJbGyBYbRwgLPCmLGsDlJJfx3xkUVIauUIXgqENm44wsFxvM1 7iK3hxlOjIWulOzLQU/Si3cEfVDc5BFAuaGWRy3EMfP5q+SLmnsi4Y6x6tGDDO0nMm76 dIJPbyVcAYwkb4QLlq7vKvp8YuBcxQw2obINS+KyIlCoNIpLvTp3v/Eb1rY4pVVvrtkX 24Mw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y65si7811584oie.92.2020.04.06.11.31.28; Mon, 06 Apr 2020 11:31:41 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726277AbgDFS3T (ORCPT + 99 others); Mon, 6 Apr 2020 14:29:19 -0400 Received: from out30-54.freemail.mail.aliyun.com ([115.124.30.54]:33577 "EHLO out30-54.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725787AbgDFS3S (ORCPT ); Mon, 6 Apr 2020 14:29:18 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R191e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e01422;MF=yang.shi@linux.alibaba.com;NM=1;PH=DS;RN=7;SR=0;TI=SMTPD_---0Tuq78hC_1586197752; Received: from US-143344MP.local(mailfrom:yang.shi@linux.alibaba.com fp:SMTPD_---0Tuq78hC_1586197752) by smtp.aliyun-inc.com(127.0.0.1); Tue, 07 Apr 2020 02:29:15 +0800 Subject: Re: [PATCHv2 4/8] khugepaged: Drain LRU add pagevec after swapin To: "Kirill A. Shutemov" , akpm@linux-foundation.org, Andrea Arcangeli Cc: Zi Yan , linux-mm@kvack.org, linux-kernel@vger.kernel.org, "Kirill A. Shutemov" References: <20200403112928.19742-1-kirill.shutemov@linux.intel.com> <20200403112928.19742-5-kirill.shutemov@linux.intel.com> From: Yang Shi Message-ID: <620a61ed-be87-f60e-f562-379cd3adbe08@linux.alibaba.com> Date: Mon, 6 Apr 2020 11:29:11 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <20200403112928.19742-5-kirill.shutemov@linux.intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 4/3/20 4:29 AM, Kirill A. Shutemov wrote: > __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(); There is already lru_add_drain() called in swap readahead path, please see swap_vma_readahead() and swap_cluster_readahead(). The extra call to draining lru seems unnecessary. > + > trace_mm_collapse_huge_page_swapin(mm, swapped_in, referenced, 1); > return true; > }