Path: csiph.com!news.redatomik.org!aioe.org!bofh.it!news.nic.it!robomod From: Shakeel Butt Newsgroups: linux.kernel Subject: Re: [RFC PATCH] mm: fadvise: avoid fadvise for fs without backing device Date: Fri, 18 Aug 2017 03:30:02 +0200 Message-ID: References: X-Original-To: Andrew Morton , Mel Gorman , Johannes Weiner , Hillf Danton , Vlastimil Babka Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=YrZqQbnzAnGCDKFqawadCKnKRxE7c3VwqFEvbxdAgfs=; b=Lol9YzN2RezBBXd6meywDj65nB9Y6Y5yZfwuKJBsGMPTivlRfhzjNv687EgocVNkxn IjjiJfi3aBt5NhwDHaF9tfVDr7cIMnXj2nczFC1w7lWxHawblaZ3DiEjQ5OkEPtC6+tg sRWNVPH5gc6LM10fISZTA4bsEbP4uqlNDSFiWpyFiFhxJnKqAnMDpWfFoAof0kpKKrod 5FXuQnl2HsVxLrP3ENl3UGHrN2wyx9BlyvK3st9rAGwwf2ycWdrjBClBAMJNLLszYtUm Cw4DifqruRB7pK/+FelzGgQbWA2HSPiy/6cGmzJJC6aeYdHw5jB7tQ0Xlxp87D6vb2oA 1KSA== X-Google-Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=YrZqQbnzAnGCDKFqawadCKnKRxE7c3VwqFEvbxdAgfs=; b=Jw0cX0G+GG0sBYKGZbyO/V1ESxuMRcHx8qeMfXMGImTMYr2YvuzehpATPWkYK8qayc +xiVgrvGLAmV7bmKu6GrCWpNTkI7Mr0Z/PDLdXwY0aAVEhvhtjQV3xSsb/e7UhlTVrEl P0wMTITX34N9vXhY+zHkIgxhrCdBOSd8ySssj87wcnsBkYq3lxsDr/5Vy5MtipUtnvOz Ur9Ohlq2cHYvDMzds67/X3hRqtLTh6e6eVsB4HetWcG6NOKmjbjy6HhiXZrKkQJMYwSU tEjgJMGU598TKlzZGyTTIq5jbWxxwLhDQYg9Z0wsJkd/rOMwsBFUj1icesccTugOsenv N9Qw== X-Gm-Message-State: AHYfb5gGO7zG1zPXPY/uE5DQYTH8VcGkWbyFe/gGbS2dxfYqzYQBO7Jr eQxnUB/RC+t384MIrhpfzn84VLkpvXcp X-Received: by 10.37.119.195 with SMTP id s186mr186771ybc.296.1503019217944; Thu, 17 Aug 2017 18:20:17 -0700 (PDT) MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Sender: robomod@news.nic.it List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Approved: robomod@news.nic.it Lines: 50 Organization: linux.* mail to news gateway X-Original-Cc: Hugh Dickins , Greg Thelen , Shakeel Butt , Linux MM , LKML X-Original-Date: Thu, 17 Aug 2017 18:20:17 -0700 X-Original-Message-ID: X-Original-References: <20170818011023.181465-1-shakeelb@google.com> X-Original-Sender: linux-kernel-owner@vger.kernel.org Xref: csiph.com linux.kernel:1714508 +linux-mm, linux-kernel On Thu, Aug 17, 2017 at 6:10 PM, Shakeel Butt wrote: > The fadvise() manpage is silent on fadvise()'s effect on > memory-based filesystems (shmem, hugetlbfs & ramfs) and pseudo > file systems (procfs, sysfs, kernfs). The current implementaion > of fadvise is mostly a noop for such filesystems except for > FADV_DONTNEED which will trigger expensive remote LRU cache > draining. This patch makes the noop of fadvise() on such file > systems very explicit. > > However this change has two side effects for ramfs and one for > tmpfs. First fadvise(FADV_DONTNEED) can remove the unmapped clean > zero'ed pages of ramfs (allocated through read, readahead & read > fault) and tmpfs (allocated through read fault). Also > fadvise(FADV_WILLNEED) on create such clean zero'ed pages for > ramfs. This change removes these two interfaces. > > Signed-off-by: Shakeel Butt > --- > mm/fadvise.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/mm/fadvise.c b/mm/fadvise.c > index a43013112581..702f239cd6db 100644 > --- a/mm/fadvise.c > +++ b/mm/fadvise.c > @@ -52,7 +52,9 @@ SYSCALL_DEFINE4(fadvise64_64, int, fd, loff_t, offset, loff_t, len, int, advice) > goto out; > } > > - if (IS_DAX(inode)) { > + bdi = inode_to_bdi(mapping->host); > + > + if (IS_DAX(inode) || (bdi == &noop_backing_dev_info)) { > switch (advice) { > case POSIX_FADV_NORMAL: > case POSIX_FADV_RANDOM: > @@ -75,8 +77,6 @@ SYSCALL_DEFINE4(fadvise64_64, int, fd, loff_t, offset, loff_t, len, int, advice) > else > endbyte--; /* inclusive */ > > - bdi = inode_to_bdi(mapping->host); > - > switch (advice) { > case POSIX_FADV_NORMAL: > f.file->f_ra.ra_pages = bdi->ra_pages; > -- > 2.14.1.480.gb18f417b89-goog >