Re: [PATCH 2/2] hugetlb reservations: fix hugetlb MAP_PRIVATE reservations across vma splits

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Mel Gorman
Date: Monday, June 23, 2008 - 12:33 am

On (20/06/08 20:17), Andy Whitcroft didst pronounce:

D'oh. It's not even that extreme, it's fairly straight-forward
to trigger as it turns out as this crappy application shows
http://www.csn.ul.ie/~mel/postings/apw-20080622/hugetlbfs-unmap-private-test.c
. This runs on x86 and can wrap the rsvd counters. I believe the other tests
I was running had already used the reserves and missed this test case.


Yeah, that does sound as if it would occur all right and running the
test program confirms it.


Clever. The additional nice thing is that it makes private mappings less of
a special case in comparison to shared mappings. My impression right now is
that with the path, shared mappings track reservations based on the underlying
file and the private mappings are generally tracked per-mapping and only share
due to unmap-related-splits or forks().  That seems a bit more consistent.


This looks sensible and applying the patches and running the test program
means that the reserve counter does not wrap when the program exists which
is very nice.  I also tested a parent-child scenario where the pool is of
insufficient size and the child gets killed as expected. Thanks a million
for cleaning this up.

Some comments below but they are relatively minor.


Ok, seems straight forward. The tuples track pages that already exist so
by counting the overlaps in a given range, you know how many hugepages
have been faulted. The size of the VMA minus the overlap is the
required reservation.


The bits move here but for good reason. private_data is now a pointer and
we pack flags into bits that are available due to alignment.  Right?


tabs vs space problem here.


Otherwise, looks right. The region_truncate() looked a bit odd but you
have call it or memory would leak so well thought out there.


The VM_BUG_ON checks are removed here. Is that intentional? They still
seem valid but maybe I am missing something.


The comment needs an update here to explain what the return value means.
I believe the reason is below.


There is an incredibly remote possibility that a fault would fail for a
mapping that had reserved huge pages because the kmalloc() in region_chg
failed. The system would have to be in terrible shape though. Should a
KERN_WARNING be printed here if this failure path is entered?  Otherwise it
will just mainfest as a SIGKILLd application.


This comment is a tad misleading. The open call is also called at fork()
time. However, in the case of fork, the private_data will be cleared.
Maybe something like;

====
The open vm_op is called when new VMAs are created but only VMAs which
have been made from another, still existing VMA will have a
reservation....
====

?


Clever. So, a split VMA will have the reference map for portions of the
mapping outside its range but region_count() ensures that we decrement
by the correct amount.


Overall, this is a really clever idea and I like that it brings private
mappings closer to shared mappings in a number of respects. 

-- 
Mel Gorman
Part-time Phd Student                          Linux Technology Center
University of Limerick                         IBM Dublin Software Lab
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
2.6.26-rc5-mm3, Andrew Morton, (Wed Jun 11, 10:59 pm)
2.6.26-rc5-mm3: kernel BUG at mm/vmscan.c:510, Alexey Dobriyan, (Thu Jun 12, 12:58 am)
Re: 2.6.26-rc5-mm3: kernel BUG at mm/vmscan.c:510, Andrew Morton, (Thu Jun 12, 1:22 am)
Re: 2.6.26-rc5-mm3: kernel BUG at mm/vmscan.c:510, Alexey Dobriyan, (Thu Jun 12, 1:23 am)
[BUG] 2.6.26-rc5-mm3 kernel BUG at mm/filemap.c:575!, Kamalesh Babulal, (Thu Jun 12, 1:44 am)
Re: [BUG] 2.6.26-rc5-mm3 kernel BUG at mm/filemap.c:575!, Andrew Morton, (Thu Jun 12, 1:57 am)
Re: [BUG] 2.6.26-rc5-mm3 kernel BUG at mm/filemap.c:575!, KAMEZAWA Hiroyuki, (Thu Jun 12, 4:20 am)
Re: 2.6.26-rc5-mm3, Byron Bradley, (Thu Jun 12, 4:32 pm)
Re: 2.6.26-rc5-mm3, Daniel Walker, (Thu Jun 12, 4:55 pm)
Re: 2.6.26-rc5-mm3, Byron Bradley, (Thu Jun 12, 5:04 pm)
Re: [BUG] 2.6.26-rc5-mm3 kernel BUG at mm/filemap.c:575!, KAMEZAWA Hiroyuki, (Thu Jun 12, 5:25 pm)
[PATCH] fix double unlock_page() in 2.6.26-rc5-mm3 kernel ..., KAMEZAWA Hiroyuki, (Thu Jun 12, 6:44 pm)
Re: [BUG] 2.6.26-rc5-mm3 kernel BUG at mm/filemap.c:575!, Valdis.Kletnieks, (Thu Jun 12, 9:18 pm)
Re: [BUG] 2.6.26-rc5-mm3 kernel BUG at mm/filemap.c:575!, Andrew Morton, (Fri Jun 13, 12:16 am)
Re: [PATCH] fix double unlock_page() in 2.6.26-rc5-mm3 ker ..., KAMEZAWA Hiroyuki, (Mon Jun 16, 7:32 pm)
[PATCH][RFC] fix kernel BUG at mm/migrate.c:719! in 2.6.26 ..., Daisuke Nishimura, (Tue Jun 17, 12:35 am)
[Bad page] trying to free locked page? (Re: [PATCH][RFC] f ..., Daisuke Nishimura, (Tue Jun 17, 12:47 am)
Re: [Bad page] trying to free locked page? (Re: [PATCH][RF ..., KAMEZAWA Hiroyuki, (Tue Jun 17, 2:03 am)
Re: [Bad page] trying to free locked page? (Re: [PATCH][RF ..., Daisuke Nishimura, (Tue Jun 17, 2:15 am)
Re: [PATCH][RFC] fix kernel BUG at mm/migrate.c:719! in 2. ..., Lee Schermerhorn, (Tue Jun 17, 10:46 am)
Re: [Bad page] trying to free locked page? (Re: [PATCH][RF ..., Lee Schermerhorn, (Tue Jun 17, 11:29 am)
Re: [PATCH][RFC] fix kernel BUG at mm/migrate.c:719! in 2. ..., Lee Schermerhorn, (Tue Jun 17, 12:28 pm)
[PATCH] unevictable mlocked pages: initialize mm member o ..., Lee Schermerhorn, (Tue Jun 17, 1:00 pm)
Re: [PATCH][RFC] fix kernel BUG at mm/migrate.c:719! in 2. ..., KAMEZAWA Hiroyuki, (Tue Jun 17, 6:13 pm)
Re: [PATCH][RFC] fix kernel BUG at mm/migrate.c:719! in 2. ..., Daisuke Nishimura, (Tue Jun 17, 6:26 pm)
Re: [PATCH][RFC] fix kernel BUG at mm/migrate.c:719! in 2. ..., Daisuke Nishimura, (Tue Jun 17, 6:54 pm)
[PATCH] migration_entry_wait fix., KAMEZAWA Hiroyuki, (Tue Jun 17, 6:54 pm)
Re: [Bad page] trying to free locked page? (Re: [PATCH][RF ..., Daisuke Nishimura, (Tue Jun 17, 7:32 pm)
Re: [Bad page] trying to free locked page? (Re: [PATCH][RF ..., Daisuke Nishimura, (Tue Jun 17, 7:40 pm)
Re: [PATCH][RFC] fix kernel BUG at mm/migrate.c:719! in 2. ..., Daisuke Nishimura, (Tue Jun 17, 7:59 pm)
Re: [PATCH][RFC] fix kernel BUG at mm/migrate.c:719! in 2. ..., Daisuke Nishimura, (Tue Jun 17, 9:41 pm)
Re: [PATCH][RFC] fix kernel BUG at mm/migrate.c:719! in 2. ..., KAMEZAWA Hiroyuki, (Tue Jun 17, 9:59 pm)
Re: [PATCH] migration_entry_wait fix., KOSAKI Motohiro, (Tue Jun 17, 10:26 pm)
Re: [PATCH] migration_entry_wait fix., Nick Piggin, (Tue Jun 17, 10:35 pm)
Re: [PATCH] migration_entry_wait fix., KAMEZAWA Hiroyuki, (Tue Jun 17, 11:04 pm)
Re: [PATCH] migration_entry_wait fix., Nick Piggin, (Tue Jun 17, 11:42 pm)
Re: [PATCH] migration_entry_wait fix., KAMEZAWA Hiroyuki, (Tue Jun 17, 11:52 pm)
Re: [PATCH -mm][BUGFIX] migration_entry_wait fix. v2, KOSAKI Motohiro, (Wed Jun 18, 12:26 am)
[PATCH -mm][BUGFIX] migration_entry_wait fix. v2, KAMEZAWA Hiroyuki, (Wed Jun 18, 12:29 am)
Re: [PATCH -mm][BUGFIX] migration_entry_wait fix. v2, Nick Piggin, (Wed Jun 18, 12:40 am)
[PATCH][-mm] remove redundant page->mapping check, KOSAKI Motohiro, (Wed Jun 18, 12:54 am)
[Experimental][PATCH] putback_lru_page rework, KAMEZAWA Hiroyuki, (Wed Jun 18, 2:40 am)
Re: [Experimental][PATCH] putback_lru_page rework, KOSAKI Motohiro, (Wed Jun 18, 4:36 am)
Re: [Experimental][PATCH] putback_lru_page rework, KAMEZAWA Hiroyuki, (Wed Jun 18, 4:55 am)
Re: [Experimental][PATCH] putback_lru_page rework, Daisuke Nishimura, (Wed Jun 18, 7:50 am)
Re: 2.6.26-rc5-mm3, Daniel Walker, (Wed Jun 18, 10:55 am)
Re: [Experimental][PATCH] putback_lru_page rework, Lee Schermerhorn, (Wed Jun 18, 11:21 am)
Re: [Experimental][PATCH] putback_lru_page rework, KAMEZAWA Hiroyuki, (Wed Jun 18, 5:22 pm)
[BUG][PATCH -mm] avoid BUG() in __stop_machine_run(), Hidehiro Kawai, (Wed Jun 18, 11:59 pm)
Re: [Experimental][PATCH] putback_lru_page rework, Daisuke Nishimura, (Thu Jun 19, 1:00 am)
Re: [Experimental][PATCH] putback_lru_page rework, KAMEZAWA Hiroyuki, (Thu Jun 19, 1:24 am)
Re: 2.6.26-rc5-mm3, Ingo Molnar, (Thu Jun 19, 2:13 am)
Re: [BUG][PATCH -mm] avoid BUG() in __stop_machine_run(), Rusty Russell, (Thu Jun 19, 3:12 am)
Re: 2.6.26-rc5-mm3, Daniel Walker, (Thu Jun 19, 7:39 am)
Re: [Experimental][PATCH] putback_lru_page rework, Lee Schermerhorn, (Thu Jun 19, 7:45 am)
Re: Re: [Experimental][PATCH] putback_lru_page rework, kamezawa.hiroyu, (Thu Jun 19, 8:32 am)
Re: [BUG][PATCH -mm] avoid BUG() in __stop_machine_run(), Jeremy Fitzhardinge, (Thu Jun 19, 8:51 am)
Re: 2.6.26-rc5-mm3: BUG large value for HugePages_Rsvd, Jon Tollefson, (Thu Jun 19, 9:27 am)
Re: 2.6.26-rc5-mm3: BUG large value for HugePages_Rsvd, Andy Whitcroft, (Thu Jun 19, 10:16 am)
Re: [Experimental][PATCH] putback_lru_page rework, KAMEZAWA Hiroyuki, (Thu Jun 19, 5:47 pm)
Re: [Experimental][PATCH] putback_lru_page rework, KAMEZAWA Hiroyuki, (Thu Jun 19, 6:13 pm)
Re: 2.6.26-rc5-mm3: BUG large value for HugePages_Rsvd, Jon Tollefson, (Thu Jun 19, 8:18 pm)
Re: Re: [Experimental][PATCH] putback_lru_page rework, Lee Schermerhorn, (Fri Jun 20, 9:24 am)
Re: [Experimental][PATCH] putback_lru_page rework, Lee Schermerhorn, (Fri Jun 20, 10:10 am)
Re: [Experimental][PATCH] putback_lru_page rework, Lee Schermerhorn, (Fri Jun 20, 1:41 pm)
Re: [Experimental][PATCH] putback_lru_page rework, KOSAKI Motohiro, (Sat Jun 21, 1:39 am)
Re: [Experimental][PATCH] putback_lru_page rework, KOSAKI Motohiro, (Sat Jun 21, 1:41 am)
Re: [Experimental][PATCH] putback_lru_page rework, KOSAKI Motohiro, (Sat Jun 21, 1:56 am)
Re: [Experimental][PATCH] putback_lru_page rework, KAMEZAWA Hiroyuki, (Sun Jun 22, 5:30 pm)
Re: [BUG][PATCH -mm] avoid BUG() in __stop_machine_run(), Rusty Russell, (Sun Jun 22, 8:55 pm)
Re: [PATCH 2/2] hugetlb reservations: fix hugetlb MAP_PRIV ..., Mel Gorman, (Mon Jun 23, 12:33 am)