Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754187AbcLLJv2 (ORCPT ); Mon, 12 Dec 2016 04:51:28 -0500 Received: from mx2.suse.de ([195.135.220.15]:52356 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750991AbcLLJv1 (ORCPT ); Mon, 12 Dec 2016 04:51:27 -0500 Date: Mon, 12 Dec 2016 09:51:24 +0000 From: Mel Gorman To: Johannes Weiner Cc: Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, kernel-team@fb.com Subject: Re: [PATCH] mm: fadvise: avoid expensive remote LRU cache draining after FADV_DONTNEED Message-ID: <20161212095124.zz6yiork6uezsczb@suse.de> References: <20161210172658.5182-1-hannes@cmpxchg.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: <20161210172658.5182-1-hannes@cmpxchg.org> User-Agent: Mutt/1.6.2 (2016-07-01) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 996 Lines: 22 On Sat, Dec 10, 2016 at 12:26:58PM -0500, Johannes Weiner wrote: > When FADV_DONTNEED cannot drop all pages in the range, it observes > that some pages might still be on per-cpu LRU caches after recent > instantiation and so initiates remote calls to all CPUs to flush their > local caches. However, in most cases, the fadvise happens from the > same context that instantiated the pages, and any pre-LRU pages in the > specified range are most likely sitting on the local CPU's LRU cache, > and so in many cases this results in unnecessary remote calls, which, > in a loaded system, can hold up the fadvise() call significantly. > > Try to avoid the remote call by flushing the local LRU cache before > even attempting to invalidate anything. It's a cheap operation, and > the local LRU cache is the most likely to hold any pre-LRU pages in > the specified fadvise range. > > Signed-off-by: Johannes Weiner Acked-by: Mel Gorman -- Mel Gorman SUSE Labs