lkml.org 
[lkml]   [2008]   [Mar]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC][2/3] Account and control virtual address space allocations
[snip]

> +int mem_cgroup_update_as(struct mm_struct *mm, long nr_pages)
> +{
> + int ret = 0;
> + struct mem_cgroup *mem;
> + if (mem_cgroup_subsys.disabled)
> + return ret;
> +
> + rcu_read_lock();
> + mem = rcu_dereference(mm->mem_cgroup);
> + css_get(&mem->css);
> + rcu_read_unlock();
> +
> + if (nr_pages > 0) {
> + if (res_counter_charge(&mem->as_res, (nr_pages * PAGE_SIZE)))
> + ret = 1;
> + } else
> + res_counter_uncharge(&mem->as_res, (-nr_pages * PAGE_SIZE));

No, please, no. Let's make two calls - mem_cgroup_charge_as and mem_cgroup_uncharge_as.

[snip]

> @@ -1117,6 +1117,9 @@ munmap_back:
> }
> }
>
> + if (mem_cgroup_update_as(mm, len >> PAGE_SHIFT))
> + return -ENOMEM;
> +

Why not use existintg cap_vm_enough_memory and co?

[snip]


\
 
 \ /
  Last update: 2008-03-17 12:57    [W:0.154 / U:1.344 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site