lkml.org 
[lkml]   [2008]   [Jun]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [1/2] memrlimit handle attach_task() failure, add can_attach() callback
On Fri, 20 Jun 2008 20:31:42 +0530
Balbir Singh <balbir@linux.vnet.ibm.com> wrote:

> +/*
> + * Add the value val to the resource counter and check if we are
> + * still under the limit.
> + */
> +static inline bool res_counter_add_check(struct res_counter *cnt,
> + unsigned long val)
> +{
> + bool ret = false;
> + unsigned long flags;
> +
> + spin_lock_irqsave(&cnt->lock, flags);
> + if (cnt->usage + val <= cnt->limit)
> + ret = true;
> + spin_unlock_irqrestore(&cnt->lock, flags);
> + return ret;
> +}

The comment and the function name imply that thins function will "Add
the value val to the resource counter". But it doesn't do that at all.
In fact the first arg could be a `const struct res_counter *'.

Perhaps res_counter_can_add() would be more accurate.


\
 
 \ /
  Last update: 2008-06-26 01:41    [from the cache]
©2003-2011 Jasper Spaans