From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E0420C4727C for ; Mon, 21 Sep 2020 22:34:35 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 5D70F23A63 for ; Mon, 21 Sep 2020 22:34:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5D70F23A63 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id CA5F2900008; Mon, 21 Sep 2020 18:34:34 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C562A900007; Mon, 21 Sep 2020 18:34:34 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B6BA4900008; Mon, 21 Sep 2020 18:34:34 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0226.hostedemail.com [216.40.44.226]) by kanga.kvack.org (Postfix) with ESMTP id 9DD62900007 for ; Mon, 21 Sep 2020 18:34:34 -0400 (EDT) Received: from smtpin07.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 5EC008249980 for ; Mon, 21 Sep 2020 22:34:34 +0000 (UTC) X-FDA: 77288524068.07.heat44_210a4db27148 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin07.hostedemail.com (Postfix) with ESMTP id 446711803F9A0 for ; Mon, 21 Sep 2020 22:34:34 +0000 (UTC) X-HE-Tag: heat44_210a4db27148 X-Filterd-Recvd-Size: 2246 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf16.hostedemail.com (Postfix) with ESMTP for ; Mon, 21 Sep 2020 22:34:33 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id B7607ABBD; Mon, 21 Sep 2020 22:35:08 +0000 (UTC) Date: Mon, 21 Sep 2020 23:34:30 +0100 From: Mel Gorman To: Yafang Shao Cc: akpm@linux-foundation.org, hannes@cmpxchg.org, mhocko@kernel.org, linux-mm@kvack.org Subject: Re: [PATCH] mm, fadvise: improve the expensive remote LRU cache draining after FADV_DONTNEED Message-ID: <20200921223430.GI3117@suse.de> References: <20200921014317.73915-1-laoar.shao@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: <20200921014317.73915-1-laoar.shao@gmail.com> User-Agent: Mutt/1.10.1 (2018-07-13) 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: On Mon, Sep 21, 2020 at 09:43:17AM +0800, Yafang Shao wrote: > Our users reported that there're some random latency spikes when their RT > process is running. Finally we found that latency spike is caused by > FADV_DONTNEED. Which may call lru_add_drain_all() to drain LRU cache on > remote CPUs, and then waits the per-cpu work to complete. The wait time > is uncertain, which may be tens millisecond. > That behavior is unreasonable, because this process is bound to a > specific CPU and the file is only accessed by itself, IOW, there should > be no pagecache pages on a per-cpu pagevec of a remote CPU. That > unreasonable behavior is partially caused by the wrong comparation of the > number of invalidated pages and the number of the target. For example, > if (count < (end_index - start_index + 1)) > The count above is how many pages were invalidated in the local CPU, and > (end_index - start_index + 1) is how many pages should be invalidated. > The usage of (end_index - start_index + 1) is incorrect, because they > are virtual addresses, which may not mapped to pages. We'd better use > inode->i_data.nrpages as the target. > How does that work if the invalidation is for a subset of the file? -- Mel Gorman SUSE Labs