Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 84097518 authored by Nick Piggin's avatar Nick Piggin Committed by Linus Torvalds
Browse files

[PATCH] mm: nommu use compound pages



Now that compound page handling is properly fixed in the VM, move nommu
over to using compound pages rather than rolling their own refcounting.

nommu vm page refcounting is broken anyway, but there is no need to have
divergent code in the core VM now, nor when it gets fixed.

Signed-off-by: default avatarNick Piggin <npiggin@suse.de>
Cc: David Howells <dhowells@redhat.com>

(Needs testing, please).
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 0f8053a5
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -87,8 +87,7 @@ static int ramfs_nommu_expand_for_mapping(struct inode *inode, size_t newsize)
	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++)
+0 −4
Original line number Diff line number Diff line
@@ -327,11 +327,7 @@ static inline void get_page(struct page *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
+0 −12
Original line number Diff line number Diff line
@@ -15,19 +15,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 */
}

static inline void __put_page(struct page *page)
+2 −2
Original line number Diff line number Diff line
@@ -159,7 +159,7 @@ void *__vmalloc(unsigned long size, gfp_t gfp_mask, pgprot_t prot)
	/*
	 * 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)
@@ -623,7 +623,7 @@ static int do_mmap_private(struct vm_area_struct *vma, unsigned long len)
	 * - 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;

+0 −7
Original line number Diff line number Diff line
@@ -422,11 +422,6 @@ static void __free_pages_ok(struct page *page, unsigned int order)
		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)
@@ -746,7 +741,6 @@ static inline void prep_zero_page(struct page *page, int order, gfp_t gfp_flags)
		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]
@@ -766,7 +760,6 @@ void split_page(struct page *page, unsigned int order)
		set_page_count(page + i, 1);
	}
}
#endif

/*
 * Really, prep_compound_page() should be called from __rmqueue_bulk().  But
Loading