lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6599ad830808111739x27078313x16ac270b42abee3c@mail.gmail.com>
Date:	Mon, 11 Aug 2008 17:39:33 -0700
From:	"Paul Menage" <menage@...gle.com>
To:	"Balbir Singh" <balbir@...ux.vnet.ibm.com>
Cc:	linux-mm@...ck.org, "Sudhir Kumar" <skumar@...ux.vnet.ibm.com>,
	"YAMAMOTO Takashi" <yamamoto@...inux.co.jp>, lizf@...fujitsu.com,
	linux-kernel@...r.kernel.org, nishimura@....nes.nec.co.jp,
	"Pavel Emelianov" <xemul@...nvz.org>, hugh@...itas.com,
	"Andrew Morton" <akpm@...ux-foundation.org>,
	"KAMEZAWA Hiroyuki" <kamezawa.hiroyu@...fujitsu.com>
Subject: Re: [-mm][PATCH 2/2] Memory rlimit enhance mm_owner_changed callback to deal with exited owner

On Mon, Aug 11, 2008 at 3:07 AM, Balbir Singh <balbir@...ux.vnet.ibm.com> wrote:
>
>
> mm_owner_changed callback can also be called with new task set to NULL.
> (race between try_to_unuse() and mm->owner exiting). Surprisingly the order
> of cgroup arguments being passed was incorrect (proves that we did not
> run into mm_owner_changed callback at all).
>
> Signed-off-by: Balbir Singh <balbir@...ux.vnet.ibm.com>

Acked-by: Paul Menage <menage@...gle.com>


> ---
>
>  mm/memrlimitcgroup.c |   15 +++++++++++++--
>  1 file changed, 13 insertions(+), 2 deletions(-)
>
> diff -puN mm/memrlimitcgroup.c~memrlimit-handle-mm-owner-notification-with-task-null mm/memrlimitcgroup.c
> --- linux-2.6.27-rc1/mm/memrlimitcgroup.c~memrlimit-handle-mm-owner-notification-with-task-null 2008-08-05 10:56:56.000000000 +0530
> +++ linux-2.6.27-rc1-balbir/mm/memrlimitcgroup.c        2008-08-05 11:24:04.000000000 +0530
> @@ -73,6 +73,12 @@ void memrlimit_cgroup_uncharge_as(struct
>  {
>        struct memrlimit_cgroup *memrcg;
>
> +       /*
> +        * Uncharge happened as a part of the mm_owner_changed callback
> +        */
> +       if (!mm->owner)
> +               return;
> +
>        memrcg = memrlimit_cgroup_from_task(mm->owner);
>        res_counter_uncharge(&memrcg->as_res, (nr_pages << PAGE_SHIFT));
>  }
> @@ -235,8 +241,8 @@ out:
>  * This callback is called with mmap_sem held
>  */
>  static void memrlimit_cgroup_mm_owner_changed(struct cgroup_subsys *ss,
> -                                               struct cgroup *cgrp,
>                                                struct cgroup *old_cgrp,
> +                                               struct cgroup *cgrp,
>                                                struct task_struct *p)
>  {
>        struct memrlimit_cgroup *memrcg, *old_memrcg;
> @@ -246,7 +252,12 @@ static void memrlimit_cgroup_mm_owner_ch
>        memrcg = memrlimit_cgroup_from_cgrp(cgrp);
>        old_memrcg = memrlimit_cgroup_from_cgrp(old_cgrp);
>
> -       if (res_counter_charge(&memrcg->as_res, (mm->total_vm << PAGE_SHIFT)))
> +       /*
> +        * If we don't have a new cgroup, we just uncharge from the old one.
> +        * It means that the task is going away
> +        */
> +       if (memrcg &&
> +           res_counter_charge(&memrcg->as_res, (mm->total_vm << PAGE_SHIFT)))
>                goto out;
>        res_counter_uncharge(&old_memrcg->as_res, (mm->total_vm << PAGE_SHIFT));
>  out:
> _
>
> --
>        Warm Regards,
>        Balbir Singh
>        Linux Technology Center
>        IBM, ISTL
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ