Re: [PATCH 07/10] res_counter: Allow charge failure pointer to benull

From: Kirill A. Shutemov
Date: Mon Oct 03 2011 - 21:31:06 EST


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@xxxxxxxxx>

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

> Cc: Paul Menage <paul@xxxxxxxxxxxxxx>
> Cc: Li Zefan <lizf@xxxxxxxxxxxxxx>
> Cc: Johannes Weiner <hannes@xxxxxxxxxxx>
> Cc: Aditya Kali <adityakali@xxxxxxxxxx>
> Cc: Oleg Nesterov <oleg@xxxxxxxxxx>
> Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
> Cc: Kay Sievers <kay.sievers@xxxxxxxx>
> Cc: Tim Hockin <thockin@xxxxxxxxxx>
> Cc: Tejun Heo <tj@xxxxxxxxxx>
> Cc: Kirill A. Shutemov <kirill@xxxxxxxxxxxxx>
> Cc: Containers <containers@xxxxxxxxxxxxxxxxxxxxxxxxxx>
> ---
> 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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/