From patchwork Mon Aug 5 17:04:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Fernandes X-Patchwork-Id: 11077633 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A7B3B1399 for ; Mon, 5 Aug 2019 17:05:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9186C2893A for ; Mon, 5 Aug 2019 17:05:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 84CFA28960; Mon, 5 Aug 2019 17:05:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 248022893A for ; Mon, 5 Aug 2019 17:05:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730103AbfHERFR (ORCPT ); Mon, 5 Aug 2019 13:05:17 -0400 Received: from mail-pf1-f195.google.com ([209.85.210.195]:38848 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730093AbfHERFQ (ORCPT ); Mon, 5 Aug 2019 13:05:16 -0400 Received: by mail-pf1-f195.google.com with SMTP id y15so39969660pfn.5 for ; Mon, 05 Aug 2019 10:05:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=hfTT9Vyh4lJ/Mb9rTCTCYXmmzA+mBf4ub6OXNmSq8us=; b=MWgO4tm5GTritoxl53gt5qNjI6dHxFHD3f2tmoGq9OJgzbnGXd/y+DqsRAV4dJJOe8 mYeyo0j3HZzU6Tao9ECna4T86NUvCDpvt4gexDupdIGfVRUQxbA+88ArezoiE9kyDdqN Lu/GqdUdfcjbf1HEszwyMIgGK8XfBF0rg6oXU= 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=hfTT9Vyh4lJ/Mb9rTCTCYXmmzA+mBf4ub6OXNmSq8us=; b=EwVotdh24ehuMYWNgtpisOFdlFyUHp2zQPdpQp/jAtXpPInaGomaxH5Qzo6AOtaYQf /lJBeISbKcvJCYdqwdMICCu/++vontna6ZNaia2o2+PsrTautWFsMR3Wm8XxprGqMtvH XhoJEym4lYs5YZzEZvnkpeseLxt50w3Hi7DbkXTBupgCPm4A4MQ//DXWqhZ+1dmeyGLO JKOZBpS8gKyySbk1Jtupj9NByjDlhradzFwvWZCub4SwyDT4sptuhUVYiPNUkXFtwGdz V0zMTsQJZHtu2N59+e2sbEjL3NcW/7hZs26fb1TC4V70FH88dW8SRCKfQtvri3LLjtdr vIzA== X-Gm-Message-State: APjAAAU692CX7kM/aTuIJmS4ofRgvrIjIC4dbyA8opSrcTErULo6tb+k eEzbfNOm1ru6qAQx3LGWaKI= X-Google-Smtp-Source: APXvYqwNN1t4bVbzgmwIXdCDQSshCIBMOslB9kNDo+lLtbCe0bb0+FNBd/Sai0oabP93PogQiVJHkw== X-Received: by 2002:a62:770e:: with SMTP id s14mr71578047pfc.150.1565024716052; Mon, 05 Aug 2019 10:05:16 -0700 (PDT) Received: from joelaf.cam.corp.google.com ([2620:15c:6:12:9c46:e0da:efbf:69cc]) by smtp.gmail.com with ESMTPSA id p23sm89832934pfn.10.2019.08.05.10.05.12 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 05 Aug 2019 10:05:15 -0700 (PDT) From: "Joel Fernandes (Google)" To: linux-kernel@vger.kernel.org Cc: "Joel Fernandes (Google)" , Alexey Dobriyan , Andrew Morton , Borislav Petkov , Brendan Gregg , Catalin Marinas , Christian Hansen , dancol@google.com, fmayer@google.com, "H. Peter Anvin" , Ingo Molnar , joelaf@google.com, Jonathan Corbet , Kees Cook , kernel-team@android.com, linux-api@vger.kernel.org, linux-doc@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, Michal Hocko , Mike Rapoport , minchan@kernel.org, namhyung@google.com, paulmck@linux.ibm.com, Robin Murphy , Roman Gushchin , Stephen Rothwell , surenb@google.com, Thomas Gleixner , tkjos@google.com, Vladimir Davydov , Vlastimil Babka , Will Deacon Subject: [PATCH v4 4/5] page_idle: Drain all LRU pagevec before idle tracking Date: Mon, 5 Aug 2019 13:04:50 -0400 Message-Id: <20190805170451.26009-4-joel@joelfernandes.org> X-Mailer: git-send-email 2.22.0.770.g0f2c4a37fd-goog In-Reply-To: <20190805170451.26009-1-joel@joelfernandes.org> References: <20190805170451.26009-1-joel@joelfernandes.org> MIME-Version: 1.0 Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP During idle tracking, we see that sometimes faulted anon pages are in pagevec but are not drained to LRU. Idle tracking considers pages only on LRU. Drain all CPU's LRU before starting idle tracking. Signed-off-by: Joel Fernandes (Google) --- mm/page_idle.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/mm/page_idle.c b/mm/page_idle.c index a5b00d63216c..2972367a599f 100644 --- a/mm/page_idle.c +++ b/mm/page_idle.c @@ -180,6 +180,8 @@ static ssize_t page_idle_bitmap_read(struct file *file, struct kobject *kobj, unsigned long pfn, end_pfn; int bit, ret; + lru_add_drain_all(); + ret = page_idle_get_frames(pos, count, NULL, &pfn, &end_pfn); if (ret == -ENXIO) return 0; /* Reads beyond max_pfn do nothing */ @@ -211,6 +213,8 @@ static ssize_t page_idle_bitmap_write(struct file *file, struct kobject *kobj, unsigned long pfn, end_pfn; int bit, ret; + lru_add_drain_all(); + ret = page_idle_get_frames(pos, count, NULL, &pfn, &end_pfn); if (ret) return ret; @@ -428,6 +432,8 @@ ssize_t page_idle_proc_generic(struct file *file, char __user *ubuff, walk.private = &priv; walk.mm = mm; + lru_add_drain_all(); + down_read(&mm->mmap_sem); /*