===== security/commoncap.c 1.2 vs edited ===== --- 1.2/security/commoncap.c Tue Jan 20 17:58:48 2004 +++ edited/security/commoncap.c Wed Jan 21 11:23:47 2004 @@ -322,7 +322,6 @@ if (sysctl_overcommit_memory == 0) { free = get_page_cache_size(); - free += nr_free_pages(); free += nr_swap_pages; /* @@ -332,7 +331,13 @@ * cache and most inode caches should fall into this */ free += atomic_read(&slab_reclaim_pages); - +#ifdef CONFIG_NUMA + /* + * Try the local pgdat first to avoid grabbing all of + * the other nodes' free_pages cachelines. + */ + free += nr_free_pages_pgdat(NODE_DATA(local_node_data->node)); +#endif /* * Leave the last 3% for root */ @@ -341,6 +346,13 @@ if (free > pages) return 0; + + /* The whole enchilada if it's a big request or we're low */ + free += nr_free_pages(); + + if (free > pages) + return 0; + vm_unacct_memory(pages); return -ENOMEM; }