linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Balbir Singh <balbir@linux.vnet.ibm.com>
Cc: yamamoto@valinux.co.jp, menage@google.com,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	kamezawa.hiroyu@jp.fujitsu.com
Subject: Re: [1/2] memrlimit handle attach_task() failure, add can_attach() callback
Date: Wed, 25 Jun 2008 16:37:53 -0700	[thread overview]
Message-ID: <20080625163753.6039c46b.akpm@linux-foundation.org> (raw)
In-Reply-To: <20080620150142.16094.48612.sendpatchset@localhost.localdomain>

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.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2008-06-25 23:37 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-20 15:01 [0/2] memrlimit improve error handling Balbir Singh
2008-06-20 15:01 ` [1/2] memrlimit handle attach_task() failure, add can_attach() callback Balbir Singh
2008-06-25 23:37   ` Andrew Morton [this message]
2008-06-25 23:52     ` Balbir Singh
2008-06-20 15:01 ` [2/2] memrlimit fix usage of tmp as a parameter name Balbir Singh
2008-06-25 23:41   ` Andrew Morton
2008-06-25 23:51     ` Balbir Singh
2008-06-24 23:11 ` [0/2] memrlimit improve error handling Hugh Dickins
2008-06-25  1:01   ` Balbir Singh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080625163753.6039c46b.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=balbir@linux.vnet.ibm.com \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=menage@google.com \
    --cc=yamamoto@valinux.co.jp \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox