From: "Vladislav D. Buzov" <vbuzov@embeddedalley.com>
To: balbir@linux.vnet.ibm.com
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Linux Containers Mailing List
<containers@lists.linux-foundation.org>,
Dan Malek <dan@embeddedalley.com>,
Andrew Morton <akpm@linux-foundation.org>,
Paul Menage <menage@google.com>,
KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Subject: Re: [PATCH 1/1] Memory usage limit notification addition to memcg
Date: Fri, 10 Jul 2009 11:01:47 -0700 [thread overview]
Message-ID: <4A57820B.9070409@embeddedalley.com> (raw)
In-Reply-To: <20090708035252.GA3215@balbir.in.ibm.com>
Balbir Singh wrote:
> Polling is never good (from the power consumption and efficiency
> view point), unless by poll you mean select() and wait on events.
>
Currently poll()/select() on a file descriptor are not supported by
cgroups. So now, it's up to user application to decide whether it's
going to periodically check memory usage or use blocking read to wait
for notification.
> Blocked read requires a dedicated thread, adding a select or some
> other notification mechanism allows the software to wait on several
> events at the same time.
>
That's true. This is the next step to be implemented. For now I just
don't want to complicate this notification feature. There is a parallel
discussion about proper threshold implementation, which I'd like to
finish first and then look at possible options for a better notification
mechanism.
> Could you clarify the meaning of "not in use"
>
The threshold represents the minimal number of bytes that should be
available under the memory controller limit before notification occurs.
For example:
limit=10M
threshold=1M
Notification fires when memory usage reaches 9M
> Could you please elaborate further, why would other mechanisms not
> work? Hint: please see cgroupstats.
>
I'm not saying that other mechanisms (other than the cgroup files) are
not going to work. The cgroup files was chosen to communicate
notifications and the blocking read is the only useful method there.
>> + /*
>> + * We check on the way in so we don't have to duplicate code
>> + * in both the normal and error exit path.
>> + */
>> + mem_cgroup_notify_test_and_wakeup(mem, mem->res.usage + PAGE_SIZE,
>> + mem->res.limit);
>> +
>>
>
> I don't think it is a good idea to directly read out mem->res.*
> without any protection
>
Why do I need to protect it here? I'm just reading values, not modifying
them. I don't have to worry if the values change after I read them, the
awaken thread will figure it out. Also, if I use res_counter interface
to read fields (res_counter_read_u64()) then it still doesn't provide
any protection.
However, I understand your concerns about data protection here and
below. In my previous email there was a discussion about moving
threshold support to the res_counter rather than keeping it in the
memory controller cgroup. I like that idea and currently working on
another patch that adds threshold support into the res_counter. It will
address all concerns about mutual exclusive access.
> Could you please use mem or memcg, since we've been using that as a
> standard convention in our code.
>
Ok.
>
>> + unsigned long long usage,
>> + unsigned long long limit)
>> +{
>> + if (unlikely(usage == RESOURCE_MAX))
>>
>
> I don't think it is a good idea to use unlikely since it is always
> likely for root to be at RESOURCE_MAX. Using likely/unlikely on user
> parameters IMHO is not a good idea.
>
I agree.
> Again, I am confused about the mutual exclusion, what protects the new
> values being added.
>
Ditto.
> Please use res_counter abstractions to read mem->res values
>
Ok.
next prev parent reply other threads:[~2009-07-10 18:02 UTC|newest]
Thread overview: 84+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-13 22:08 [PATCH] Memory usage limit notification addition to memcg Dan Malek
2009-04-13 23:08 ` Andrew Morton
[not found] ` <20090413160814.1c335d1d.akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
2009-04-13 23:45 ` Dan Malek
2009-04-13 23:45 ` Dan Malek
[not found] ` <298A09AD-495E-4671-84A1-B831826424A8-L1vi/lXTdtvkgf6YlCu6wwC/G2K4zDHf@public.gmane.org>
2009-04-13 23:54 ` Andrew Morton
2009-04-13 23:54 ` Andrew Morton
[not found] ` <20090413165404.b6660aea.akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
2009-04-14 0:52 ` Dan Malek
2009-04-14 0:52 ` Dan Malek
[not found] ` <1239660512-25468-1-git-send-email-dan-L1vi/lXTdtvkgf6YlCu6wwC/G2K4zDHf@public.gmane.org>
2009-04-13 23:08 ` Andrew Morton
2009-07-07 20:25 ` [PATCH 0/1] " Vladislav Buzov
2009-07-07 20:25 ` Vladislav Buzov
2009-07-07 20:25 ` [PATCH 1/1] " Vladislav Buzov
2009-07-08 0:56 ` KAMEZAWA Hiroyuki
[not found] ` <20090708095616.cdfe8c7c.kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
2009-07-09 1:43 ` Vladislav D. Buzov
2009-07-13 22:15 ` Paul Menage
2009-07-13 22:15 ` Paul Menage
2009-07-14 1:00 ` Vladislav D. Buzov
[not found] ` <4A5BD8C5.1060902-L1vi/lXTdtvkgf6YlCu6wwC/G2K4zDHf@public.gmane.org>
2009-07-14 1:03 ` KAMEZAWA Hiroyuki
2009-07-14 1:03 ` KAMEZAWA Hiroyuki
2009-07-14 1:43 ` KOSAKI Motohiro
[not found] ` <20090714100440.6283.A69D9226-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
2009-07-14 19:13 ` Dan Malek
2009-07-14 19:13 ` Dan Malek
[not found] ` <9B7C6FE2-D946-4286-9537-C4A715997B89-L1vi/lXTdtvkgf6YlCu6wwC/G2K4zDHf@public.gmane.org>
2009-07-16 17:15 ` Balbir Singh
2009-07-16 17:15 ` Balbir Singh
[not found] ` <20090716171530.GC3576-SINUvgVNF2CyUtPGxGje5AC/G2K4zDHf@public.gmane.org>
2009-07-16 18:16 ` Dan Malek
2009-07-16 18:16 ` Dan Malek
[not found] ` <FE89F36E-EB7E-4F11-887C-5371887C7D68-L1vi/lXTdtvkgf6YlCu6wwC/G2K4zDHf@public.gmane.org>
2009-07-17 2:33 ` Balbir Singh
2009-07-17 2:33 ` Balbir Singh
2009-07-15 6:02 ` Balbir Singh
[not found] ` <6599ad830907131515h3c9622b5v309cf8f13d272bab-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-07-14 1:00 ` Vladislav D. Buzov
2009-07-14 1:43 ` KOSAKI Motohiro
2009-07-15 6:02 ` Balbir Singh
2009-07-09 1:43 ` Vladislav D. Buzov
2009-07-09 1:43 ` Vladislav D. Buzov
[not found] ` <4A554B54.3080903-L1vi/lXTdtvkgf6YlCu6wwC/G2K4zDHf@public.gmane.org>
2009-07-13 0:52 ` KAMEZAWA Hiroyuki
2009-07-13 0:52 ` KAMEZAWA Hiroyuki
2009-07-13 0:52 ` KAMEZAWA Hiroyuki
[not found] ` <20090713095209.d8b6e566.kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
2009-07-13 21:21 ` Vladislav D. Buzov
2009-07-13 21:21 ` Vladislav D. Buzov
2009-07-13 21:21 ` Vladislav D. Buzov
[not found] ` <1246998310-16764-2-git-send-email-vbuzov-L1vi/lXTdtvkgf6YlCu6wwC/G2K4zDHf@public.gmane.org>
2009-07-08 0:56 ` KAMEZAWA Hiroyuki
2009-07-08 3:52 ` Balbir Singh
2009-07-08 3:52 ` Balbir Singh
[not found] ` <20090708035252.GA3215-SINUvgVNF2CyUtPGxGje5AC/G2K4zDHf@public.gmane.org>
2009-07-10 18:01 ` Vladislav D. Buzov
2009-07-10 18:01 ` Vladislav D. Buzov [this message]
[not found] ` <1246998310-16764-1-git-send-email-vbuzov-L1vi/lXTdtvkgf6YlCu6wwC/G2K4zDHf@public.gmane.org>
2009-07-07 20:25 ` Vladislav Buzov
2009-07-14 0:16 ` [PATCH 0/2] Memory usage limit notification feature (v3) Vladislav Buzov
2009-07-14 0:16 ` Vladislav Buzov
2009-07-14 0:16 ` Vladislav Buzov
2009-07-14 0:16 ` [PATCH 1/2] Resource usage threshold notification addition to res_counter (v3) Vladislav Buzov
2009-07-14 0:16 ` Vladislav Buzov
2009-07-14 0:16 ` [PATCH 2/2] Memory usage limit notification addition to memcg (v3) Vladislav Buzov
2009-07-14 0:16 ` Vladislav Buzov
2009-07-14 0:30 ` [PATCH 1/2] Resource usage threshold notification addition to res_counter (v3) KAMEZAWA Hiroyuki
2009-07-14 0:30 ` KAMEZAWA Hiroyuki
[not found] ` <20090714093022.6e8c1cc0.kamezawa.hiroyu-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
2009-07-14 1:29 ` Vladislav D. Buzov
2009-07-14 1:29 ` Vladislav D. Buzov
2009-07-14 1:29 ` Vladislav D. Buzov
[not found] ` <4A5BDF5D.8090306-L1vi/lXTdtvkgf6YlCu6wwC/G2K4zDHf@public.gmane.org>
2009-07-14 1:45 ` KAMEZAWA Hiroyuki
2009-07-14 1:45 ` KAMEZAWA Hiroyuki
2009-07-14 1:45 ` KAMEZAWA Hiroyuki
2009-07-14 0:36 ` Paul Menage
2009-07-14 0:36 ` Paul Menage
[not found] ` <6599ad830907131736w4397d336xad733f274c812690-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-07-14 0:47 ` KAMEZAWA Hiroyuki
2009-07-14 0:47 ` KAMEZAWA Hiroyuki
2009-07-14 0:47 ` KAMEZAWA Hiroyuki
[not found] ` <1247530581-31416-2-git-send-email-vbuzov-L1vi/lXTdtvkgf6YlCu6wwC/G2K4zDHf@public.gmane.org>
2009-07-14 0:16 ` [PATCH 2/2] Memory usage limit notification addition to memcg (v3) Vladislav Buzov
2009-07-14 0:30 ` [PATCH 1/2] Resource usage threshold notification addition to res_counter (v3) KAMEZAWA Hiroyuki
2009-07-14 0:36 ` Paul Menage
2009-07-14 0:20 ` [PATCH 0/2] Memory usage limit notification feature (v3) Paul Menage
2009-07-14 0:20 ` Paul Menage
[not found] ` <6599ad830907131720j4f7e1649y4866d2ddeae862c5-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-07-14 0:31 ` KOSAKI Motohiro
2009-07-14 0:31 ` KOSAKI Motohiro
2009-07-14 0:31 ` KOSAKI Motohiro
[not found] ` <1247530581-31416-1-git-send-email-vbuzov-L1vi/lXTdtvkgf6YlCu6wwC/G2K4zDHf@public.gmane.org>
2009-07-14 0:16 ` [PATCH 1/2] Resource usage threshold notification addition to res_counter (v3) Vladislav Buzov
2009-07-14 0:20 ` [PATCH 0/2] Memory usage limit notification feature (v3) Paul Menage
2009-04-15 0:35 ` [PATCH] Memory usage limit notification addition to memcg KAMEZAWA Hiroyuki
2009-04-15 2:34 ` Dan Malek
2009-04-15 2:58 ` KAMEZAWA Hiroyuki
2009-04-15 7:32 ` Dan Malek
2009-04-15 7:33 ` KAMEZAWA Hiroyuki
2009-04-15 8:24 ` Balbir Singh
2009-04-15 17:35 ` Dan Malek
2009-04-16 3:15 ` 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=4A57820B.9070409@embeddedalley.com \
--to=vbuzov@embeddedalley.com \
--cc=akpm@linux-foundation.org \
--cc=balbir@linux.vnet.ibm.com \
--cc=containers@lists.linux-foundation.org \
--cc=dan@embeddedalley.com \
--cc=kamezawa.hiroyu@jp.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=menage@google.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.