lkml.org 
[lkml]   [1999]   [Jun]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: oom() _still_ killing init
On Thu, 17 Jun 1999, Oliver Xymoron wrote:

>> void oom(struct task_struct * task)
>> {
>> + if (task->pid == 1)
>> + goto out;
>> printk("\nOut of memory for %s.\n", task->comm);
>> force_sig(SIGKILL, task);
>> + out:
>> }
>
>You're kidding. Tell me you're joking, please. This is the most
>superfluous use of a goto I've ever seen. There are good reasons not to
>use gotos, such as readability, maintainability, reliability, and the
>like. While performance may take precedence in schedule (at least until we
>make the compiler smarter), the same is certainly not true here.

Agreed, we could place there an mdelay(1000) and nobody would ever
complain :).

I may also have used a:

if (task->pid != 1)
{
send_sig
}

and that would have preserved the fast path too in every sane compiler.

Unfortunately I like very much using goto in cases like the above one but
since most of people dislike them I'll continue avoid using `goto' (when
not needed) the next times. (thanks for reminding me that)

>I haven't looked at the patch you want me to apply this over (I need to

Please try out 2.2.10_andrea-VM6.gz (you should have the URL for it).

Andrea Arcangeli


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:52    [W:0.107 / U:0.040 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site