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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6599ad830812050139l5797f16kaf511f831b09e8f4@mail.gmail.com>
Date:	Fri, 5 Dec 2008 01:39:00 -0800
From:	Paul Menage <menage@...gle.com>
To:	KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>
Cc:	"linux-mm@...ck.org" <linux-mm@...ck.org>,
	"nishimura@....nes.nec.co.jp" <nishimura@....nes.nec.co.jp>,
	"balbir@...ux.vnet.ibm.com" <balbir@...ux.vnet.ibm.com>,
	"lizf@...fujitsu.com" <lizf@...fujitsu.com>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [RFC][PATCH 1/4] New css->refcnt implementation.

On Fri, Dec 5, 2008 at 12:28 AM, KAMEZAWA Hiroyuki
<kamezawa.hiroyu@...fujitsu.com> wrote:
>
> From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujisu.com>
>
> Now, the last check of refcnt is done after pre_destroy(), so rmdir() can fail
> after pre_destroy(). But memcg set mem->obsolete to be 1 at pre_destroy.
> This is a bug. So, removing memcg->obsolete flag is sane.
>
> But there is no interface to confirm "css" is oboslete or not. I.e. there is
> no flag to check whether we can increase css_refcnt or not!

The basic rule is that you're only supposed to increment the css
refcount if you have:

- a reference to a task in the cgroup (that is pinned via task_lock()
so it can't be moved away)
or
- an existing reference to the css

>
> This patch changes this css->refcnt rule as following
>        - css->refcnt is no longer private counter, just point to
>          css->cgroup->css_refcnt.

The reason I didn't do this is that I'd like to keep the ref counts
separate to make it possible to add/remove subsystems from a hiearchy
- if they're all mingled into a single refcount, it's impossible to
tell if a particular subsystem has refcounts.

>
>        - css_put() is changed not to call notify_on_release().
>
>          From documentation, notify_on_release() is called when there is no
>          tasks/children in cgroup. On implementation, notify_on_release is
>          not called if css->refcnt > 0.

The documentation is a little inaccurate - it's called when the cgroup
is removable. In the original cpusets this implied that there were no
tasks or children; in cgroups, a refcount can keep the group alive
too, so it's right to not call notify_on_release if there are
remaining refcounts.

>          This is problem. Memcg has css->refcnt by each page even when
>          there are no tasks. Release handler will be never called.

Right, because it can't remove the dir if there are still refcounts.

Early in the development of cgroups I did have a css refcount scheme
similar to what you have, with tryget, etc, but still with separate
refcounts for each subsystem; I got rid of it since it seemed more
complicated than we needed at the time. But I'll see if I can dig it
up.

Paul
--
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