<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/mm/fadvise.c, branch v3.7-rc5</title>
<subtitle>Linux Kernel (branches are rebased on master from time to time)</subtitle>
<id>https://sre.ring0.de/linux/atom?h=v3.7-rc5</id>
<link rel='self' href='https://sre.ring0.de/linux/atom?h=v3.7-rc5'/>
<link rel='alternate' type='text/html' href='https://sre.ring0.de/linux/'/>
<updated>2012-09-27T02:20:08Z</updated>
<entry>
<title>switch simple cases of fget_light to fdget</title>
<updated>2012-09-27T02:20:08Z</updated>
<author>
<name>Al Viro</name>
<email>viro@zeniv.linux.org.uk</email>
</author>
<published>2012-08-28T16:52:22Z</published>
<link rel='alternate' type='text/html' href='https://sre.ring0.de/linux/commit/?id=2903ff019b346ab8d36ebbf54853c3aaf6590608'/>
<id>urn:sha1:2903ff019b346ab8d36ebbf54853c3aaf6590608</id>
<content type='text'>
Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</content>
</entry>
<entry>
<title>switch fadvise(2) to fget_light()</title>
<updated>2012-09-27T01:10:04Z</updated>
<author>
<name>Al Viro</name>
<email>viro@zeniv.linux.org.uk</email>
</author>
<published>2012-08-27T00:27:09Z</published>
<link rel='alternate' type='text/html' href='https://sre.ring0.de/linux/commit/?id=611443783ada3464c44e9168f6b7de2cb3fed39a'/>
<id>urn:sha1:611443783ada3464c44e9168f6b7de2cb3fed39a</id>
<content type='text'>
Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</content>
</entry>
<entry>
<title>mm, fadvise: don't return -EINVAL when filesystem cannot implement fadvise()</title>
<updated>2012-08-01T01:42:42Z</updated>
<author>
<name>KOSAKI Motohiro</name>
<email>kosaki.motohiro@jp.fujitsu.com</email>
</author>
<published>2012-07-31T23:42:50Z</published>
<link rel='alternate' type='text/html' href='https://sre.ring0.de/linux/commit/?id=3d3727cdb07ff17ddc3c551ef8d03d37b60a0372'/>
<id>urn:sha1:3d3727cdb07ff17ddc3c551ef8d03d37b60a0372</id>
<content type='text'>
Eric Wong reported his test suite failex when /tmp is tmpfs.

https://lkml.org/lkml/2012/2/24/479

Currentlt the input check of POSIX_FADV_WILLNEED has two problems.

- requires a_ops-&gt;readpage.  But in fact, force_page_cache_readahead()
  requires that the target filesystem has either -&gt;readpage or -&gt;readpages.

- returns -EINVAL when the filesystem doesn't have -&gt;readpage.  But
  posix says that fadvise is merely a hint.  Thus fadvise() should return
  0 if filesystem has no means of implementing fadvise().  The userland
  application should not know nor care whcih type of filesystem backs the
  TMPDIR directory, as Eric pointed out.  There is nothing which userspace
  can do to solve this error.

So change the return value to 0 when filesytem doesn't support readahead.

[akpm@linux-foundation.org: checkpatch fixes]
Signed-off-by: KOSAKI Motohiro &lt;kosaki.motohiro@jp.fujitsu.com&gt;
Cc: Hugh Dickins &lt;hughd@google.com&gt;
Cc: Hillf Danton &lt;dhillf@gmail.com&gt;
Signed-off-by: Eric Wong &lt;normalperson@yhbt.net&gt;
Tested-by: Eric Wong &lt;normalperson@yhbt.net&gt;
Reviewed-by: Wanlong Gao &lt;gaowanlong@cn.fujitsu.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>fadvise: only initiate writeback for specified range with FADV_DONTNEED</title>
<updated>2012-01-11T00:30:43Z</updated>
<author>
<name>Shawn Bohrer</name>
<email>sbohrer@rgmadvisors.com</email>
</author>
<published>2012-01-10T23:07:35Z</published>
<link rel='alternate' type='text/html' href='https://sre.ring0.de/linux/commit/?id=ad8a1b558e6c76fb53901956d3c8f29b82a4ccfa'/>
<id>urn:sha1:ad8a1b558e6c76fb53901956d3c8f29b82a4ccfa</id>
<content type='text'>
Previously POSIX_FADV_DONTNEED would start writeback for the entire file
when the bdi was not write congested.  This negatively impacts performance
if the file contains dirty pages outside of the requested range.  This
change uses __filemap_fdatawrite_range() to only initiate writeback for
the requested range.

Signed-off-by: Shawn Bohrer &lt;sbohrer@rgmadvisors.com&gt;
Acked-by: Johannes Weiner &lt;jweiner@redhat.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>readahead: introduce FMODE_RANDOM for POSIX_FADV_RANDOM</title>
<updated>2010-03-06T19:26:25Z</updated>
<author>
<name>Wu Fengguang</name>
<email>fengguang.wu@intel.com</email>
</author>
<published>2010-03-05T21:42:03Z</published>
<link rel='alternate' type='text/html' href='https://sre.ring0.de/linux/commit/?id=0141450f66c3c12a3aaa869748caa64241885cdf'/>
<id>urn:sha1:0141450f66c3c12a3aaa869748caa64241885cdf</id>
<content type='text'>
This fixes inefficient page-by-page reads on POSIX_FADV_RANDOM.

POSIX_FADV_RANDOM used to set ra_pages=0, which leads to poor performance:
a 16K read will be carried out in 4 _sync_ 1-page reads.

In other places, ra_pages==0 means
- it's ramfs/tmpfs/hugetlbfs/sysfs/configfs
- some IO error happened
where multi-page read IO won't help or should be avoided.

POSIX_FADV_RANDOM actually want a different semantics: to disable the
*heuristic* readahead algorithm, and to use a dumb one which faithfully
submit read IO for whatever application requests.

So introduce a flag FMODE_RANDOM for POSIX_FADV_RANDOM.

Note that the random hint is not likely to help random reads performance
noticeably.  And it may be too permissive on huge request size (its IO
size is not limited by read_ahead_kb).

In Quentin's report (http://lkml.org/lkml/2009/12/24/145), the overall
(NFS read) performance of the application increased by 313%!

Tested-by: Quentin Barnes &lt;qbarnes+nfs@yahoo-inc.com&gt;
Signed-off-by: Wu Fengguang &lt;fengguang.wu@intel.com&gt;
Cc: Nick Piggin &lt;npiggin@suse.de&gt;
Cc: Andi Kleen &lt;andi@firstfloor.org&gt;
Cc: Steven Whitehouse &lt;swhiteho@redhat.com&gt;
Cc: David Howells &lt;dhowells@redhat.com&gt;
Cc: Jonathan Corbet &lt;corbet@lwn.net&gt;
Cc: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
Cc: Christoph Hellwig &lt;hch@infradead.org&gt;
Cc: Trond Myklebust &lt;Trond.Myklebust@netapp.com&gt;
Cc: Chuck Lever &lt;chuck.lever@oracle.com&gt;
Cc: &lt;stable@kernel.org&gt;			[2.6.33.x]
Cc: &lt;qbarnes+nfs@yahoo-inc.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>readahead: move max_sane_readahead() calls into force_page_cache_readahead()</title>
<updated>2009-06-17T02:47:28Z</updated>
<author>
<name>Wu Fengguang</name>
<email>fengguang.wu@intel.com</email>
</author>
<published>2009-06-16T22:31:20Z</published>
<link rel='alternate' type='text/html' href='https://sre.ring0.de/linux/commit/?id=f7e839dd36fd940b0202cfb7d39b2a1b2dc59b1b'/>
<id>urn:sha1:f7e839dd36fd940b0202cfb7d39b2a1b2dc59b1b</id>
<content type='text'>
Impact: code simplification.

Cc: Nick Piggin &lt;npiggin@suse.de&gt;
Signed-off-by: Wu Fengguang &lt;fengguang.wu@intel.com&gt;
Cc: Ying Han &lt;yinghan@google.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>[CVE-2009-0029] System call wrapper special cases</title>
<updated>2009-01-14T13:15:18Z</updated>
<author>
<name>Heiko Carstens</name>
<email>heiko.carstens@de.ibm.com</email>
</author>
<published>2009-01-14T13:14:02Z</published>
<link rel='alternate' type='text/html' href='https://sre.ring0.de/linux/commit/?id=6673e0c3fbeaed2cd08e2fd4a4aa97382d6fedb0'/>
<id>urn:sha1:6673e0c3fbeaed2cd08e2fd4a4aa97382d6fedb0</id>
<content type='text'>
System calls with an unsigned long long argument can't be converted with
the standard wrappers since that would include a cast to long, which in
turn means that we would lose the upper 32 bit on 32 bit architectures.
Also semctl can't use the standard wrapper since it has a 'union'
parameter.

So we handle them as special case and add some extra wrappers instead.

Signed-off-by: Heiko Carstens &lt;heiko.carstens@de.ibm.com&gt;
</content>
</entry>
<entry>
<title>Remove Andrew Morton's old email accounts</title>
<updated>2008-10-16T18:21:32Z</updated>
<author>
<name>Francois Cami</name>
<email>francois.cami@free.fr</email>
</author>
<published>2008-10-16T05:01:59Z</published>
<link rel='alternate' type='text/html' href='https://sre.ring0.de/linux/commit/?id=e1f8e87449147ffe5ea3de64a46af7de450ce279'/>
<id>urn:sha1:e1f8e87449147ffe5ea3de64a46af7de450ce279</id>
<content type='text'>
People can use the real name an an index into MAINTAINERS to find the
current email address.

Signed-off-by: Francois Cami &lt;francois.cami@free.fr&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>xip: support non-struct page backed memory</title>
<updated>2008-04-28T15:58:23Z</updated>
<author>
<name>Nick Piggin</name>
<email>npiggin@suse.de</email>
</author>
<published>2008-04-28T09:13:02Z</published>
<link rel='alternate' type='text/html' href='https://sre.ring0.de/linux/commit/?id=70688e4dd1647f0ceb502bbd5964fa344c5eb411'/>
<id>urn:sha1:70688e4dd1647f0ceb502bbd5964fa344c5eb411</id>
<content type='text'>
Convert XIP to support non-struct page backed memory, using VM_MIXEDMAP for
the user mappings.

This requires the get_xip_page API to be changed to an address based one.
Improve the API layering a little bit too, while we're here.

This is required in order to support XIP filesystems on memory that isn't
backed with struct page (but memory with struct page is still supported too).

Signed-off-by: Nick Piggin &lt;npiggin@suse.de&gt;
Acked-by: Carsten Otte &lt;cotte@de.ibm.com&gt;
Cc: Jared Hulbert &lt;jaredeh@gmail.com&gt;
Cc: Martin Schwidefsky &lt;schwidefsky@de.ibm.com&gt;
Cc: Heiko Carstens &lt;heiko.carstens@de.ibm.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>check ADVICE of fadvise64_64 even if get_xip_page is given</title>
<updated>2008-02-05T17:44:19Z</updated>
<author>
<name>Masatake YAMATO</name>
<email>yamato@redhat.com</email>
</author>
<published>2008-02-05T06:29:31Z</published>
<link rel='alternate' type='text/html' href='https://sre.ring0.de/linux/commit/?id=b5beb1caff4ce063e6e2dc13f23b80eeef4e9782'/>
<id>urn:sha1:b5beb1caff4ce063e6e2dc13f23b80eeef4e9782</id>
<content type='text'>
I've written some test programs in ltp project.  During writing I met an
problem which I cannot solve in user land.  So I wrote a patch for linux
kernel.  Please, include this patch if acceptable.

The test program tests the 4th parameter of fadvise64_64:

    long sys_fadvise64_64(int fd, loff_t offset, loff_t len, int advice);

My test case calls fadvise64_64 with invalid advice value and checks errno is
set to EINVAL.  About the advice parameter man page says:

    ...
    Permissible values for advice include:

	   POSIX_FADV_NORMAL
                  ...
	   POSIX_FADV_SEQUENTIAL
                  ...
	   POSIX_FADV_RANDOM
		  ...
	   POSIX_FADV_NOREUSE
                  ...
	   POSIX_FADV_WILLNEED
                  ...
	   POSIX_FADV_DONTNEED
		  ...
    ERRORS
           ...
	   EINVAL An invalid value was specified for advice.

However, I got a bug report that the system call invocations
in my test case returned 0 unexpectedly.

I've inspected the kernel code:

    asmlinkage long sys_fadvise64_64(int fd, loff_t offset, loff_t len, int advice)
    {
	    struct file *file = fget(fd);
	    struct address_space *mapping;
	    struct backing_dev_info *bdi;
	    loff_t endbyte;			/* inclusive */
	    pgoff_t start_index;
	    pgoff_t end_index;
	    unsigned long nrpages;
	    int ret = 0;

	    if (!file)
		    return -EBADF;

	    if (S_ISFIFO(file-&gt;f_path.dentry-&gt;d_inode-&gt;i_mode)) {
		    ret = -ESPIPE;
		    goto out;
	    }

	    mapping = file-&gt;f_mapping;
	    if (!mapping || len &lt; 0) {
		    ret = -EINVAL;
		    goto out;
	    }

	    if (mapping-&gt;a_ops-&gt;get_xip_page)
		    /* no bad return value, but ignore advice */
		    goto out;
    ...
    out:
	    fput(file);
	    return ret;
    }

I found the advice parameter is just ignored in the case
mapping-&gt;a_ops-&gt;get_xip_page is given. This behavior is different from
what is written on the man page. Is this o.k.?

get_xip_page is given if CONFIG_EXT2_FS_XIP is true.
Anyway I cannot find the easy way to detect get_xip_page
field is given or CONFIG_EXT2_FS_XIP is true from the
user space.

I propose the following patch which checks the advice parameter
even if get_xip_page is given.

Signed-off-by: Masatake YAMATO &lt;yamato@redhat.com&gt;
Acked-by: Carsten Otte &lt;cotte@de.ibm.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
</feed>
