lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 16 Oct 2014 17:29:23 -0400
From:	Matthew Wilcox <willy@...ux.intel.com>
To:	Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
Cc:	Matthew Wilcox <matthew.r.wilcox@...el.com>,
	linux-fsdevel@...r.kernel.org, linux-mm@...ck.org,
	linux-kernel@...r.kernel.org, Calvin Owens <jcalvinowens@...il.com>
Subject: Re: [PATCH v11 09/21] dax,ext2: Replace the XIP page fault handler
 with the DAX page fault handler

On Thu, Oct 16, 2014 at 12:20:47PM +0200, Mathieu Desnoyers wrote:
> > +/*
> > + * The user has performed a load from a hole in the file.  Allocating
> > + * a new page in the file would cause excessive storage usage for
> > + * workloads with sparse files.  We allocate a page cache page instead.
> > + * We'll kick it out of the page cache if it's ever written to,
> > + * otherwise it will simply fall out of the page cache under memory
> > + * pressure without ever having been dirtied.
> 
> Nice trick :)

It's basically what the page cache does.  Unfortunately, I had to step
out of the room while Calvin detailed his trick for doing it differently,
but if his patch goes in, we should follow suit.

> > +		if (!page) {
> > +			mutex_lock(&mapping->i_mmap_mutex);
> > +			/* Check we didn't race with truncate */
> > +			size = (i_size_read(inode) + PAGE_SIZE - 1) >>
> > +								PAGE_SHIFT;
> > +			if (vmf->pgoff >= size) {
> > +				mutex_unlock(&mapping->i_mmap_mutex);
> > +				error = -EIO;
> > +				goto out;
> > +			}
> > +		}
> 
> If page is non-NULL, is it possible that we return VM_FAULT_LOCKED
> without actually holding i_mmap_mutex ? Is it on purpose ?
> 
> > +		return VM_FAULT_LOCKED;
> > +	}

That's right; this is the original meaning of VM_FAULT_LOCKED, that the
page lock is held.  We took it before the call to get_block(), ensuring
that we don't hit the truncate race.  Er ... hang on.  At some point in
the revising of patches, I dropped the stanza where we re-check i_size
after grabbing the page lock.  Sod ... a v12 of this patchset will have
to be forthcoming!
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ