nommu use compound pages?
Subsystems (4)
Hi,
This topic came up about a year ago but I couldn't work out why it never happened. Possibly because compound pages wheren't always enabled.
Now that they are, can we have another shot? It would be great to unify all this stuff finally. I must admit I'm not too familiar with the nommu code, but I couldn't find a fundamental problem from the archives.
Nick
--
include/linux/mm.h +0 -4
@@ -338,11 +338,7 @@ static inline void get_page(struct pagevoid put_page (struct page *page); -#ifdef CONFIG_MMU void split_page (struct page *page,unsigned int order); -#else -static inline void split_page (struct page *page,unsigned int order) {} -#endif /* * Multiple processes may "see" the same page. E.g. for untouched
mm/internal.h +0 -12
@@ -11,19 +11,7 @@static inline void set_page_refs (struct page *page,int order) { -#ifdef CONFIG_MMU set_page_count (page,1 ); -#else -int i; - -/* -* We need to reference all the pages for this order, otherwise if -* anyone accesses one of the pages with (get/put) it will be freed. -* - eg: access_process_vm() -*/ -for (i =0 ; i < (1 << order); i++) -set_page_count (page + i,1 ); -#endif /* CONFIG_MMU */ } extern void fastcall __init __free_pages_bootmem(struct page *page,
mm/page_alloc.c +0 -7
@@ -422,11 +422,6 @@ static void __free_pages_ok(struct pagemutex_debug_check_no_locks_freed (page_address (page),PAGE_SIZE <<order); -#ifndef CONFIG_MMU -for (i =1 ; i < (1 << order) ; ++i) -__put_page (page + i); -#endif -for (i =0 ; i < (1 << order) ; ++i) reserved +=free_pages_check (page + i);if (reserved)
@@ -747,7 +742,6 @@ static inline void prep_zero_page(structclear_highpage (page + i); } -#ifdef CONFIG_MMU /* * split_page takes a non-compound higher-order page, and splits it into * n (1<<order) sub-pages: page[0..n]
@@ -767,7 +761,6 @@ void split_page(struct page *page, unsigset_page_count (page + i,1 ); } } -#endif /* * Really, prep_compound_page() should be called from __rmqueue_bulk(). But
fs/ramfs/file-nommu.c +1 -2
@@ -87,8 +87,7 @@ static int ramfs_nommu_expand_for_mappin xpages =1UL << order; npages = (newsize +PAGE_SIZE -1 ) >>PAGE_SHIFT ; -for (loop =0 ; loop < npages; loop++) -set_page_count (pages + loop,1 ); +split_page (pages, order);/* trim off any pages we don't actually require */ for (loop = npages; loop < xpages; loop++)
mm/nommu.c +2 -2
@@ -158,7 +158,7 @@ void *__vmalloc(unsigned long size, gfp_/* * kmalloc doesn't like __GFP_HIGHMEM for some reason */ -return kmalloc (size, gfp_mask & ~__GFP_HIGHMEM); +return kmalloc (size, (gfp_mask | __GFP_COMP) & ~__GFP_HIGHMEM); }struct page *vmalloc_to_page (void *addr)
@@ -615,7 +615,7 @@ static int do_mmap_private(struct vm_are* - note that this may not return a page-aligned address if the object * we're allocating is smaller than a page */ - base =kmalloc (len,GFP_KERNEL ); + base =kmalloc (len,GFP_KERNEL |__GFP_COMP);if (!base) goto enomem;
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 9 lines · Nick Piggin
Hi,
This topic came up about a year ago but I couldn't work out why it never happened. Possibly because compound pages wheren't always enabled.
Now that they are, can we have another shot? It would be great to unify all this stuff finally. I must admit I'm not too familiar with the nommu code, but I couldn't find a fundamental problem from the archives.
I still don't know why nommu uses these at all. Cc'in the uclinux maintainer and list owuld be helpfull if you'd like to find out though.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 6 lines · Christoph Hellwig
Quoted 5 lines · Nick Piggin
Hi,
This topic came up about a year ago but I couldn't work out why it never happened. Possibly because compound pages wheren't always enabled.
Quoted 7 lines
Quoted 4 lines
Now that they are, can we have another shot? It would be great to unify all this stuff finally. I must admit I'm not too familiar with the nommu code, but I couldn't find a fundamental problem from the archives.
I still don't know why nommu uses these at all. Cc'in the uclinux maintainer and list owuld be helpfull if you'd like to find out though.
AFAIK, David has a handle on the issues, but I will take your advice.
Now that I have some more ears, I'll see if I have the issues right:
Quoted 1 line
From what I could _gather_, anonymous memory is allocated with kmalloc,
which may be backed by a higher order allocation. Refcounting is done at the vma level. However, get_user_pages can do a 0->1 transition on the constituent pages' refcounts and a subsequent put_page would free them.
Possibly cleaner would be to have a put_user_pages function instead of having callers do the put_page themselves (though I haven't looked through all callsites so this may not be possible).
nommu would then simply use their vma based refcounting entirely. The current per-page refcounting in nommu get_user_pages looks scary/racy against their vma refcounting anyway.
However, my main concern is to remove the hacks in the core VM made for nommu -- I hope a simple patch like this will turn out to be possible.
Thanks,
Nick
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 1 line · Nick Piggin
AFAIK, David has a handle on the issues, but I will take your advice.
If you can wait a week and a half, I'll go over it again when I get back from NZ. IIRC, the problem was that Andrew wouldn't take the patches because he always seemed to have too many other MM/VM patches.
David
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 8 lines · David Howells
Quoted 1 line · Nick Piggin
AFAIK, David has a handle on the issues, but I will take your advice.
If you can wait a week and a half, I'll go over it again when I get back from NZ. IIRC, the problem was that Andrew wouldn't take the patches because he always seemed to have too many other MM/VM patches.
Sure.
Removed the uclinux list from cc because posting is limited to subscribers.
Nick
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>