OpenVZ Forum


Home » Mailing lists » Devel » [PATCH] memcg: Do not open code accesses to res_counter members
Re: [PATCH] memcg: Do not open code accesses to res_counter members [message #45832 is a reply to message #45581] Thu, 05 April 2012 23:53 Go to previous message
akpm is currently offline  akpm
Messages: 224
Registered: March 2007
Senior Member
On Tue, 20 Mar 2012 20:53:44 +0400
Glauber Costa <glommer@parallels.com> wrote:

> We should use the acessor res_counter_read_u64 for that.
> Although a purely cosmetic change is sometimes better of delayed,
> to avoid conflicting with other people's work, we are starting to
> have people touching this code as well, and reproducing the open
> code behavior because that's the standard =)
>
> ...
>
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -3708,7 +3708,7 @@ move_account:
> goto try_to_free;
> cond_resched();
> /* "ret" should also be checked to ensure all lists are empty. */
> - } while (memcg->res.usage > 0 || ret);
> + } while (res_counter_read_u64(&memcg->res, RES_USAGE) > 0 || ret);
> out:
> css_put(&memcg->css);
> return ret;
> @@ -3723,7 +3723,7 @@ try_to_free:
> lru_add_drain_all();
> /* try to free all pages in this cgroup */
> shrink = 1;
> - while (nr_retries && memcg->res.usage > 0) {
> + while (nr_retries && res_counter_read_u64(&memcg->res, RES_USAGE) > 0) {
> int progress;
>
> if (signal_pending(current)) {

Actually this fixes bugs on 32-bit machines. Good luck trying to
demonstrate them at runtime though ;)
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: [PATCH] SUNRPC: register PipeFS file system after pernet sybsystem
Next Topic: [RFC 0/7] Initial proposal for faster res_counter updates
Goto Forum:
  


Current Time: Thu Jul 11 13:04:24 GMT 2024

Total time taken to generate the page: 0.02217 seconds