lkml.org 
[lkml]   [2011]   [Oct]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 07/10] res_counter: Allow charge failure pointer to be null
On Mon, Oct 03, 2011 at 09:07:09PM +0200, Frederic Weisbecker wrote:
> So that callers of res_counter_charge() don't have to create and
> pass this pointer even if they aren't interested in it.
>
> Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>

Acked-by: Kirill A. Shutemov <kirill@shutemov.name>

> Cc: Paul Menage <paul@paulmenage.org>
> Cc: Li Zefan <lizf@cn.fujitsu.com>
> Cc: Johannes Weiner <hannes@cmpxchg.org>
> Cc: Aditya Kali <adityakali@google.com>
> Cc: Oleg Nesterov <oleg@redhat.com>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Kay Sievers <kay.sievers@vrfy.org>
> Cc: Tim Hockin <thockin@hockin.org>
> Cc: Tejun Heo <tj@kernel.org>
> Cc: Kirill A. Shutemov <kirill@shutemov.name>
> Cc: Containers <containers@lists.linux-foundation.org>
> ---
> kernel/res_counter.c | 6 ++++--
> 1 files changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/res_counter.c b/kernel/res_counter.c
> index 8f4c728..6b36823 100644
> --- a/kernel/res_counter.c
> +++ b/kernel/res_counter.c
> @@ -43,14 +43,16 @@ int res_counter_charge_until(struct res_counter *counter,
> unsigned long flags;
> struct res_counter *c, *u;
>
> - *limit_fail_at = NULL;
> + if (limit_fail_at)
> + *limit_fail_at = NULL;
> local_irq_save(flags);
> for (c = counter; c != limit; c = c->parent) {
> spin_lock(&c->lock);
> ret = res_counter_charge_locked(c, val);
> spin_unlock(&c->lock);
> if (ret < 0) {
> - *limit_fail_at = c;
> + if (limit_fail_at)
> + *limit_fail_at = c;
> goto undo;
> }
> }
> --
> 1.7.5.4
>

--
Kirill A. Shutemov


\
 
 \ /
  Last update: 2011-10-04 03:33    [W:0.165 / U:0.108 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site