Re: [Qemu-devel] Fix refcounting in hugetlbfs quota handling

2011-08-16 Thread Andrew Barry
It is not a unique KVM problem. We saw the race while doing large async rDMA in our network driver, but I can imagine it happening with a slow NFS server, or other DMA that could complete after umount. What I need, in order to push this upstream, is: 1. For you to light a fire under my feet to get

Re: [Qemu-devel] Fix refcounting in hugetlbfs quota handling

2011-08-15 Thread David Gibson
On Mon, Aug 15, 2011 at 03:25:35PM -0500, Andrew Barry wrote: > I've been doing something similar to this last proposal. I put a > hugetlbfs_sb_info pointer into page_private, and dropped a reference counter > and > an active/inactive bit into the hugetlbfs_sb_info struct. At Umount time, the > sb

Re: [Qemu-devel] Fix refcounting in hugetlbfs quota handling

2011-08-15 Thread Andrew Barry
I've been doing something similar to this last proposal. I put a hugetlbfs_sb_info pointer into page_private, and dropped a reference counter and an active/inactive bit into the hugetlbfs_sb_info struct. At Umount time, the sbinfo is freed, only if the reference count is zero. Otherwise, the last p

Re: [Qemu-devel] Fix refcounting in hugetlbfs quota handling

2011-08-15 Thread Hugh Dickins
On Sat, 13 Aug 2011, David Gibson wrote: > On Fri, Aug 12, 2011 at 12:15:21PM -0700, Hugh Dickins wrote: > > > > Setting that aside, I think this thing of grabbing a reference to inode > > for each page just does not work as you wish: when we unlink an inode, > > all its pages should be freed; but

Re: [Qemu-devel] Fix refcounting in hugetlbfs quota handling

2011-08-12 Thread David Gibson
On Fri, Aug 12, 2011 at 12:15:21PM -0700, Hugh Dickins wrote: > On Fri, 12 Aug 2011, Minchan Kim wrote: > > On Fri, Aug 12, 2011 at 9:48 AM, Linus Torvalds > > wrote: > > > On Wed, Aug 10, 2011 at 11:40 PM, David Gibson > > > wrote: > > >> > > >> This patch, therefore, stores a pointer to the ino

Re: [Qemu-devel] Fix refcounting in hugetlbfs quota handling

2011-08-12 Thread Christoph Hellwig
On Thu, Aug 11, 2011 at 04:40:59PM +1000, David Gibson wrote: > Linus, please apply > > hugetlbfs tracks the current usage of hugepages per hugetlbfs > mountpoint. To correctly track this when hugepages are released, it > must find the right hugetlbfs super_block from the struct page > available

Re: [Qemu-devel] Fix refcounting in hugetlbfs quota handling

2011-08-12 Thread Hugh Dickins
On Fri, 12 Aug 2011, Minchan Kim wrote: > On Fri, Aug 12, 2011 at 9:48 AM, Linus Torvalds > wrote: > > On Wed, Aug 10, 2011 at 11:40 PM, David Gibson > > wrote: > >> > >> This patch, therefore, stores a pointer to the inode instead of the > >> address_space in the page private data for hugepages.

Re: [Qemu-devel] Fix refcounting in hugetlbfs quota handling

2011-08-11 Thread Minchan Kim
On Fri, Aug 12, 2011 at 9:48 AM, Linus Torvalds wrote: > On Wed, Aug 10, 2011 at 11:40 PM, David Gibson > wrote: >> >> This patch, therefore, stores a pointer to the inode instead of the >> address_space in the page private data for hugepages.  More >> importantly it correctly adjusts the referen

Re: [Qemu-devel] Fix refcounting in hugetlbfs quota handling

2011-08-11 Thread Linus Torvalds
On Wed, Aug 10, 2011 at 11:40 PM, David Gibson wrote: > > This patch, therefore, stores a pointer to the inode instead of the > address_space in the page private data for hugepages.  More > importantly it correctly adjusts the reference count on the inodes > when they're added to the page private

[Qemu-devel] Fix refcounting in hugetlbfs quota handling

2011-08-10 Thread David Gibson
Linus, please apply hugetlbfs tracks the current usage of hugepages per hugetlbfs mountpoint. To correctly track this when hugepages are released, it must find the right hugetlbfs super_block from the struct page available in free_huge_page(). It does this by storing a pointer to the hugepage's