summaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2000-07-23 14:05:01 +0000
committerRalf Baechle <ralf@linux-mips.org>2000-07-23 14:05:01 +0000
commitf3627cbe9236a062012c836f3b6ee311b43f63f2 (patch)
treeae854838b9a73b35bd0f3b8f42e5fb7f9cb1d5a9 /mm
parentfea12a7b3f20bc135ab533491411e9ff753c01c8 (diff)
Merge with Linux 2.4.0-test5-pre4.
Diffstat (limited to 'mm')
-rw-r--r--mm/filemap.c2
-rw-r--r--mm/page_alloc.c47
2 files changed, 46 insertions, 3 deletions
diff --git a/mm/filemap.c b/mm/filemap.c
index 3b0078045..688682aad 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -1744,9 +1744,7 @@ static int msync_interval(struct vm_area_struct * vma,
struct file * file = vma->vm_file;
if (file && file->f_op && file->f_op->fsync) {
down(&file->f_dentry->d_inode->i_sem);
- lock_kernel();
error = file->f_op->fsync(file, file->f_dentry, 1);
- unlock_kernel();
up(&file->f_dentry->d_inode->i_sem);
}
}
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index ae05cf8f8..7843d553b 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -64,7 +64,8 @@ static int zone_balance_max[MAX_NR_ZONES] = { 255 , 255, 255, };
* Hint: -mask = 1+~mask
*/
-void __free_pages_ok (struct page *page, unsigned long order)
+static void FASTCALL(__free_pages_ok (struct page *page, unsigned long order));
+static void __free_pages_ok (struct page *page, unsigned long order)
{
unsigned long index, page_idx, mask, flags;
free_area_t *area;
@@ -316,6 +317,50 @@ fail:
}
/*
+ * Common helper functions.
+ */
+unsigned long __get_free_pages(int gfp_mask, unsigned long order)
+{
+ struct page * page;
+
+ page = alloc_pages(gfp_mask, order);
+ if (!page)
+ return 0;
+ return page_address(page);
+}
+
+unsigned long get_zeroed_page(int gfp_mask)
+{
+ struct page * page;
+
+ page = alloc_pages(gfp_mask, 0);
+ if (page) {
+ unsigned long address = page_address(page);
+ clear_page((void *)address);
+ return address;
+ }
+ return 0;
+}
+
+void __free_pages(struct page *page, unsigned long order)
+{
+ if (put_page_testzero(page))
+ __free_pages_ok(page, order);
+}
+
+void free_pages(unsigned long addr, unsigned long order)
+{
+ unsigned long map_nr;
+
+#ifdef CONFIG_DISCONTIGMEM
+ if (addr == 0) return;
+#endif
+ map_nr = MAP_NR(addr);
+ if (map_nr < max_mapnr)
+ __free_pages(mem_map + map_nr, order);
+}
+
+/*
* Total amount of free (allocatable) RAM:
*/
unsigned int nr_free_pages (void)