public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Mauricio Lin <mauriciolin@gmail.com>
To: tglx@linutronix.de
Cc: Andrea Arcangeli <andrea@suse.de>,
	Marcelo Tosatti <marcelo.tosatti@cyclades.com>,
	Edjard Souza Mota <edjard@gmail.com>,
	LKML <linux-kernel@vger.kernel.org>,
	Andrew Morton <akpm@osdl.org>
Subject: Re: User space out of memory approach
Date: Tue, 25 Jan 2005 20:11:19 -0400	[thread overview]
Message-ID: <3f250c71050125161175234ef9@mail.gmail.com> (raw)
In-Reply-To: <1106689179.4538.22.camel@tglx.tec.linutronix.de>

Hi Thomaz,

On Tue, 25 Jan 2005 22:39:39 +0100, Thomas Gleixner <tglx@linutronix.de> wrote:
> On Tue, 2005-01-25 at 17:13 -0400, Mauricio Lin wrote:
> > Hi Andrea,
> >
> > Your OOM Killer patch was tested and a strange behaviour was found.
> > Basically as normal user we started some applications as openoffice,
> > mozilla and emacs.
> > And as a root (in another tty) we started a simple program that uses
> > malloc in a forever loop as below:
> >
> > int main (void)
> > {
> >   int * mem;
> >   for (;;)
> >         mem = (int *) malloc(sizeof(int));
> >   return 0;
> > }
> >
> >
> > Using the original OOM Killer, malloc is the first killed application
> > and the sytem is restored in a useful state. After applying your patch
> > and accomplish the same experiment, the OOM Killer it does not kill
> > malloc program and it enters in a kind of forever loop as below:
> >
> > 1) out_of_memory is invoked;
> > 2) select_bad_process is invoked;
> 
> Which process is selected ?
Sometimes the first application to be killed is XFree. AFAIK the
malloc is never killed, because the OOM Killer does not stop to do its
work. Usually we are not able to check the kernel log file after
rebooting the system. Because nothing was written there (perhaps
syslogd or klogd were killed during OOM). But I can see the printk
messages on the screen during OOM Killer action. This does not happen
with original OOM Killer.

I put some printk in order to trace the OOM Killer and IMHO what is going is:

out_of_memory function is invoked and after that the
select_bad_process is also invoked.
So its starts to point each task. But during the do_each_thread /
while each_thread loop the
condition:

if ((unlikely(test_tsk_thread_flag(p, TIF_MEMDIE)) || (p->flags &
PF_EXITING)) &&
			    !(p->flags & PF_DEAD))
       return ERR_PTR(-1UL);

is true and it leaves from select_bad_process function because of the
return statement.

So the running code return from the point that select_bad_process was
called, i.e., in the out_of_memory function. The condition statement
in out_of_memory function:

if (PTR_ERR(p) == -1UL)
		goto out;

is also true so it goes to "out" label and leaves from the
out_of_memory function. But because of the OOM state the out_of_memory
function is invoked again and after that the select_bad_process is
also invoked again. And during the do_each_thread / while each_thread
loop the same condition as mentioned above is true again. So it leaves
from select_bad_process function because of the return statement and
goes to "out" label and
leaves from the out_of_memory function again. This behaviour is
repeated continuously
during a long time until I stop waiting and reboot the system using my
own finger.

> Can you please show the kernel messages ?

OK. We will try to reach a situation that the printk messages can be
written entirely in the log file and show you the kernel messages. But
as I said: usually the printks messages are not written in the log
file using Andrea's patch. But using the original OOM Killer we can
see the messages in the log file. The syslog.conf file is the same for
both OOM Killer(Andrea and Original). Do you have any idea what is
happening to log file?

If you do not mind, you can accomplish the same test case as I
mentioned on my last email. I would like to know if this problem
happens to others people as well.

We tested on the laptop and desktop machines with 128MB of RAM and
swap space disabled.


BR,

Mauricio Lin.

  reply	other threads:[~2005-01-26  0:15 UTC|newest]

Thread overview: 70+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-10 21:43 User space out of memory approach Mauricio Lin
2005-01-10 19:20 ` Marcelo Tosatti
2005-01-10 19:39   ` Marcelo Tosatti
2005-01-10 23:01     ` Mauricio Lin
2005-01-10 22:40   ` Edjard Souza Mota
2005-01-10 20:05     ` Marcelo Tosatti
2005-01-10 23:17       ` Edjard Souza Mota
2005-01-10 23:18         ` Edjard Souza Mota
2005-01-10 23:24       ` Mauricio Lin
2005-01-10 23:30         ` Mauricio Lin
2005-01-11  7:47         ` Marcelo Tosatti
2005-01-11  0:35       ` Thomas Gleixner
2005-01-11  2:03         ` Edjard Souza Mota
2005-01-11  8:44           ` Thomas Gleixner
2005-01-11  8:58             ` Andrea Arcangeli
2005-01-11  7:48               ` Marcelo Tosatti
2005-01-11  9:08               ` Andrew Morton
2005-01-11  9:19                 ` Andrea Arcangeli
2005-01-11  9:27                   ` Andrew Morton
2005-01-11  9:20             ` Edjard Souza Mota
2005-01-11  9:30               ` Thomas Gleixner
2005-01-11  9:56                 ` Andrea Arcangeli
2005-01-11 10:05                   ` Edjard Souza Mota
2005-01-11 10:39                     ` Thomas Gleixner
2005-01-11 10:44                     ` Andrea Arcangeli
2005-01-11 14:56                       ` Edjard Souza Mota
2005-01-11 15:27                       ` Ilias Biris
2005-01-11 10:00                 ` Edjard Souza Mota
2005-01-11 10:36                   ` Thomas Gleixner
2005-01-11 16:32             ` Alan Cox
2005-01-11 19:16               ` Ilias Biris
2005-01-11 20:46                 ` Ilias Biris
2005-01-11 20:57                   ` Thomas Gleixner
2005-01-12  9:31                     ` Edjard Souza Mota
2005-01-12 11:19                       ` Thomas Gleixner
2005-01-12 12:12                         ` Edjard Souza Mota
2005-01-13 15:36                   ` Alan Cox
2005-01-16 10:06                     ` Edjard Souza Mota
2005-01-16 21:10                       ` Alan Cox
2005-01-17 10:16                         ` Thomas Gleixner
2005-01-11 21:35                 ` Denis Vlasenko
2005-01-11 20:40               ` Thomas Gleixner
2005-01-11  7:42         ` Marcelo Tosatti
2005-01-11 10:51           ` Thomas Gleixner
2005-01-11 11:03             ` Andrea Arcangeli
2005-01-11  8:38         ` Andrea Arcangeli
2005-01-21 21:27           ` Mauricio Lin
2005-01-21 21:45             ` Mauricio Lin
2005-01-22  3:32               ` Andrea Arcangeli
2005-01-25 21:13                 ` Mauricio Lin
2005-01-25 21:39                   ` Thomas Gleixner
2005-01-26  0:11                     ` Mauricio Lin [this message]
2005-01-26  0:49                       ` Andrea Arcangeli
2005-01-26 14:03                         ` Mauricio Lin
2005-01-27 18:54                         ` Mauricio Lin
2005-01-27 22:11                           ` Andrea Arcangeli
2005-01-27 22:29                             ` Andrew Morton
2005-01-27 22:58                               ` Andrea Arcangeli
2005-01-27 23:35                                 ` Andrew Morton
2005-01-28  0:15                                   ` Andrea Arcangeli
2005-01-28 13:58                             ` Mauricio Lin
2005-01-28 15:21                               ` Mauricio Lin
2005-01-28 15:29                                 ` Andrea Arcangeli
2005-01-26  7:26                       ` Thomas Gleixner
2005-01-22  3:04             ` Andrea Arcangeli
     [not found] <fa.lcmt90h.1j1scpn@ifi.uio.no>
     [not found] ` <fa.ht4gei4.1g5odia@ifi.uio.no>
2005-01-16 16:28   ` Bodo Eggert
2005-01-18 13:15     ` Edjard Souza Mota
2005-01-19  6:18       ` Bodo Eggert
2005-01-20  3:20         ` Edjard Souza Mota
2005-01-20  5:00           ` Bodo Eggert

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=3f250c71050125161175234ef9@mail.gmail.com \
    --to=mauriciolin@gmail.com \
    --cc=akpm@osdl.org \
    --cc=andrea@suse.de \
    --cc=edjard@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcelo.tosatti@cyclades.com \
    --cc=tglx@linutronix.de \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox