From: Balbir Singh <balbir@linux.vnet.ibm.com>
To: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Dave Hansen <dave@linux.vnet.ibm.com>,
Paul Menage <menage@google.com>,
Dave Hansen <haveblue@us.ibm.com>,
Andrea Righi <righi.andrea@gmail.com>,
Hugh Dickins <hugh@veritas.com>,
Andrew Morton <akpm@linux-foundation.org>,
Linux Memory Management List <linux-mm@kvack.org>,
linux kernel mailing list <linux-kernel@vger.kernel.org>
Subject: Re: [discuss] memrlimit - potential applications that can use
Date: Thu, 21 Aug 2008 16:43:54 +0530 [thread overview]
Message-ID: <48AD4DF2.3050700@linux.vnet.ibm.com> (raw)
In-Reply-To: <20080821195915.f1ecd012.kamezawa.hiroyu@jp.fujitsu.com>
KAMEZAWA Hiroyuki wrote:
> On Thu, 21 Aug 2008 15:56:41 +0530
> Balbir Singh <balbir@linux.vnet.ibm.com> wrote:
>
>> KAMEZAWA Hiroyuki wrote:
>>> On Thu, 21 Aug 2008 08:55:52 +0530
>>> Balbir Singh <balbir@linux.vnet.ibm.com> wrote:
>>>
>>>>>>> So, before we expand the use of those features to control groups by
>>>>>>> adding a bunch of new code, let's make sure that there will be users
>>>>>> for
>>>>>>> it and that those users have no better way of doing it.
>>>>>> I am all ears to better ways of doing it. Are you suggesting that overcommit was
>>>>>> added even though we don't actually need it?
>>>>> It serves a purpose, certainly. We have have better ways of doing it
>>>>> now, though. "So, before we expand the use of those features to
>>>>> control groups by adding a bunch of new code, let's make sure that there
>>>>> will be users for it and that those users have no better way of doing
>>>>> it."
>>>>>
>>>>> The one concrete user that's been offered so far is postgres. I've
>>>> No, you've been offered several, including php and apache that use memory limits.
>>>>
>>>>> suggested something that I hope will be more effective than enforcing
>>>>> overcommit.
>>> I'm sorry I miss the point. My concern on memrlimit (for overcommiting) is that
>>> it's not fair because an application which get -ENOMEM at mmap() is just someone
>>> unlucky.
>> It can happen today with overcommit turned on. Why is it unlucky?
>>
> Today's overcommit is also unlucky ;)
>
> For example) process A and B is under a memrlimit.
> process A no memory leak, it often calls malloc() and free().
> process B does memory leak, 100MB per night.
>
> process A cannot do anything when it notices malloc() returns NULL.
> It controls his memory usage perfectly. He is unlucky and will die.
> process B can use up VSZ which is freed by process A.
>
Yes, true that will happen. Why will A die because it sees NULL? Yes, many
applications do die, but that is not how malloc == NULL is expected to be
handled. If that is a concern, do not use any memrlimits for A and B, if you do
you will find the bug early.
Now consider the other scenario, if there really is a memory leak and process B
is using all that memory, two things to consider
1. Without swap controller, B will start swapping out A's memory and cause
excessive swapping and performance loss
2. With swap controller enabled, at some point we will hit the swap limit, what
happens then?
> (OOM-killer, is disliked by everyone, have some kind of fairness.
> It checks usage.)
>
>> I think it's better to trigger some notifier to application or daemon
>>> rather than return -ENOMEM at mmap(). Notification like "Oh, it seems the VSZ
>>> of total application exceeds the limit you set. Although you can continue your
>>> operation, it's recommended that you should fix up the situation".
>>> will be good.
>>>
>> So you are suggesting that when we are running out of memory (as defined by our
>> current resource constraints), we don't return -ENOMEM, but instead we now
>> handle a new event that states that we are running out of memory?
>>
> Not "running out of memory" Just "VSZ is over the limit you set/expected".
>
> My point is an application witch can handle NULL returned by malloc() is
> not very popular, I think.
>
Yes and that's why we have the flexibility, if the application can't deal with
it don't set memrlimits for those applications :)
--
Balbir
WARNING: multiple messages have this Message-ID (diff)
From: Balbir Singh <balbir@linux.vnet.ibm.com>
To: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Dave Hansen <dave@linux.vnet.ibm.com>,
Paul Menage <menage@google.com>,
Dave Hansen <haveblue@us.ibm.com>,
Andrea Righi <righi.andrea@gmail.com>,
Hugh Dickins <hugh@veritas.com>,
Andrew Morton <akpm@linux-foundation.org>,
Linux Memory Management List <linux-mm@kvack.org>,
linux kernel mailing list <linux-kernel@vger.kernel.org>
Subject: Re: [discuss] memrlimit - potential applications that can use
Date: Thu, 21 Aug 2008 16:43:54 +0530 [thread overview]
Message-ID: <48AD4DF2.3050700@linux.vnet.ibm.com> (raw)
In-Reply-To: <20080821195915.f1ecd012.kamezawa.hiroyu@jp.fujitsu.com>
KAMEZAWA Hiroyuki wrote:
> On Thu, 21 Aug 2008 15:56:41 +0530
> Balbir Singh <balbir@linux.vnet.ibm.com> wrote:
>
>> KAMEZAWA Hiroyuki wrote:
>>> On Thu, 21 Aug 2008 08:55:52 +0530
>>> Balbir Singh <balbir@linux.vnet.ibm.com> wrote:
>>>
>>>>>>> So, before we expand the use of those features to control groups by
>>>>>>> adding a bunch of new code, let's make sure that there will be users
>>>>>> for
>>>>>>> it and that those users have no better way of doing it.
>>>>>> I am all ears to better ways of doing it. Are you suggesting that overcommit was
>>>>>> added even though we don't actually need it?
>>>>> It serves a purpose, certainly. We have have better ways of doing it
>>>>> now, though. "i>>?So, before we expand the use of those features to
>>>>> control groups by adding a bunch of new code, let's make sure that there
>>>>> will be users for it and that those users have no better way of doing
>>>>> it."
>>>>>
>>>>> The one concrete user that's been offered so far is postgres. I've
>>>> No, you've been offered several, including php and apache that use memory limits.
>>>>
>>>>> suggested something that I hope will be more effective than enforcing
>>>>> overcommit.
>>> I'm sorry I miss the point. My concern on memrlimit (for overcommiting) is that
>>> it's not fair because an application which get -ENOMEM at mmap() is just someone
>>> unlucky.
>> It can happen today with overcommit turned on. Why is it unlucky?
>>
> Today's overcommit is also unlucky ;)
>
> For example) process A and B is under a memrlimit.
> process A no memory leak, it often calls malloc() and free().
> process B does memory leak, 100MB per night.
>
> process A cannot do anything when it notices malloc() returns NULL.
> It controls his memory usage perfectly. He is unlucky and will die.
> process B can use up VSZ which is freed by process A.
>
Yes, true that will happen. Why will A die because it sees NULL? Yes, many
applications do die, but that is not how malloc == NULL is expected to be
handled. If that is a concern, do not use any memrlimits for A and B, if you do
you will find the bug early.
Now consider the other scenario, if there really is a memory leak and process B
is using all that memory, two things to consider
1. Without swap controller, B will start swapping out A's memory and cause
excessive swapping and performance loss
2. With swap controller enabled, at some point we will hit the swap limit, what
happens then?
> (OOM-killer, is disliked by everyone, have some kind of fairness.
> It checks usage.)
>
>> I think it's better to trigger some notifier to application or daemon
>>> rather than return -ENOMEM at mmap(). Notification like "Oh, it seems the VSZ
>>> of total application exceeds the limit you set. Although you can continue your
>>> operation, it's recommended that you should fix up the situation".
>>> will be good.
>>>
>> So you are suggesting that when we are running out of memory (as defined by our
>> current resource constraints), we don't return -ENOMEM, but instead we now
>> handle a new event that states that we are running out of memory?
>>
> Not "running out of memory" Just "VSZ is over the limit you set/expected".
>
> My point is an application witch can handle NULL returned by malloc() is
> not very popular, I think.
>
Yes and that's why we have the flexibility, if the application can't deal with
it don't set memrlimits for those applications :)
--
Balbir
--
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>
next prev parent reply other threads:[~2008-08-21 11:15 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-19 7:18 [discuss] memrlimit - potential applications that can use Balbir Singh
2008-08-19 7:18 ` Balbir Singh
2008-08-19 15:58 ` Dave Hansen
2008-08-19 15:58 ` Dave Hansen
2008-08-19 16:45 ` Balbir Singh
2008-08-19 16:45 ` Balbir Singh
2008-08-19 17:41 ` Dave Hansen
2008-08-19 17:41 ` Dave Hansen
2008-08-20 8:26 ` Balbir Singh
2008-08-20 8:26 ` Balbir Singh
2008-08-20 16:29 ` Dave Hansen
2008-08-20 16:29 ` Dave Hansen
2008-08-21 3:25 ` Balbir Singh
2008-08-21 3:25 ` Balbir Singh
2008-08-21 7:43 ` KAMEZAWA Hiroyuki
2008-08-21 7:43 ` KAMEZAWA Hiroyuki
2008-08-21 10:26 ` Balbir Singh
2008-08-21 10:26 ` Balbir Singh
2008-08-21 10:59 ` KAMEZAWA Hiroyuki
2008-08-21 10:59 ` KAMEZAWA Hiroyuki
2008-08-21 11:13 ` Balbir Singh [this message]
2008-08-21 11:13 ` Balbir Singh
2008-08-21 15:18 ` righi.andrea
2008-08-21 15:18 ` righi.andrea
2008-08-20 13:25 ` righi.andrea
2008-08-20 13:25 ` righi.andrea
2008-08-20 16:38 ` Dave Hansen
2008-08-20 16:38 ` Dave Hansen
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=48AD4DF2.3050700@linux.vnet.ibm.com \
--to=balbir@linux.vnet.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=dave@linux.vnet.ibm.com \
--cc=haveblue@us.ibm.com \
--cc=hugh@veritas.com \
--cc=kamezawa.hiroyu@jp.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=menage@google.com \
--cc=righi.andrea@gmail.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.