* nommu use compound pages?
@ 2006-01-25 9:15 Nick Piggin
2006-01-25 14:13 ` Christoph Hellwig
0 siblings, 1 reply; 5+ messages in thread
From: Nick Piggin @ 2006-01-25 9:15 UTC (permalink / raw)
To: David Howells, Andrew Morton, Linux Memory Management List
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
--
Index: linux-2.6/include/linux/mm.h
===================================================================
--- linux-2.6.orig/include/linux/mm.h
+++ linux-2.6/include/linux/mm.h
@@ -338,11 +338,7 @@ static inline void get_page(struct page
void 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
Index: linux-2.6/mm/internal.h
===================================================================
--- linux-2.6.orig/mm/internal.h
+++ linux-2.6/mm/internal.h
@@ -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,
Index: linux-2.6/mm/page_alloc.c
===================================================================
--- linux-2.6.orig/mm/page_alloc.c
+++ linux-2.6/mm/page_alloc.c
@@ -422,11 +422,6 @@ static void __free_pages_ok(struct page
mutex_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(struct
clear_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, unsig
set_page_count(page + i, 1);
}
}
-#endif
/*
* Really, prep_compound_page() should be called from __rmqueue_bulk(). But
Index: linux-2.6/fs/ramfs/file-nommu.c
===================================================================
--- linux-2.6.orig/fs/ramfs/file-nommu.c
+++ linux-2.6/fs/ramfs/file-nommu.c
@@ -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++)
Index: linux-2.6/mm/nommu.c
===================================================================
--- linux-2.6.orig/mm/nommu.c
+++ linux-2.6/mm/nommu.c
@@ -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 majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: nommu use compound pages?
2006-01-25 9:15 nommu use compound pages? Nick Piggin
@ 2006-01-25 14:13 ` Christoph Hellwig
2006-01-25 14:39 ` Nick Piggin
2006-01-25 18:43 ` David Howells
0 siblings, 2 replies; 5+ messages in thread
From: Christoph Hellwig @ 2006-01-25 14:13 UTC (permalink / raw)
To: Nick Piggin; +Cc: David Howells, Andrew Morton, Linux Memory Management List
On Wed, Jan 25, 2006 at 10:15:09AM +0100, Nick Piggin wrote:
> 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 majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: nommu use compound pages?
2006-01-25 14:13 ` Christoph Hellwig
@ 2006-01-25 14:39 ` Nick Piggin
2006-01-25 18:43 ` David Howells
1 sibling, 0 replies; 5+ messages in thread
From: Nick Piggin @ 2006-01-25 14:39 UTC (permalink / raw)
To: Christoph Hellwig
Cc: Nick Piggin, David Howells, Andrew Morton,
Linux Memory Management List, gerg, uclinux-dev
On Wed, Jan 25, 2006 at 02:13:56PM +0000, Christoph Hellwig wrote:
> On Wed, Jan 25, 2006 at 10:15:09AM +0100, Nick Piggin wrote:
> > 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.
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:
>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 majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: nommu use compound pages?
2006-01-25 14:13 ` Christoph Hellwig
2006-01-25 14:39 ` Nick Piggin
@ 2006-01-25 18:43 ` David Howells
2006-01-25 19:02 ` Nick Piggin
1 sibling, 1 reply; 5+ messages in thread
From: David Howells @ 2006-01-25 18:43 UTC (permalink / raw)
To: Nick Piggin
Cc: Christoph Hellwig, David Howells, Andrew Morton,
Linux Memory Management List, gerg, uclinux-dev
Nick Piggin <npiggin@suse.de> wrote:
> 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 majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: nommu use compound pages?
2006-01-25 18:43 ` David Howells
@ 2006-01-25 19:02 ` Nick Piggin
0 siblings, 0 replies; 5+ messages in thread
From: Nick Piggin @ 2006-01-25 19:02 UTC (permalink / raw)
To: David Howells
Cc: Nick Piggin, Christoph Hellwig, Andrew Morton,
Linux Memory Management List, gerg
On Wed, Jan 25, 2006 at 06:43:39PM +0000, David Howells wrote:
> Nick Piggin <npiggin@suse.de> wrote:
>
> > 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 majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2006-01-25 19:02 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-01-25 9:15 nommu use compound pages? Nick Piggin
2006-01-25 14:13 ` Christoph Hellwig
2006-01-25 14:39 ` Nick Piggin
2006-01-25 18:43 ` David Howells
2006-01-25 19:02 ` Nick Piggin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox