2007-09-21 17:06:44

by Alexey Dobriyan

[permalink] [raw]
Subject: Re: + oom-move-prototypes-to-appropriate-header-file.patch added to -mm tree

On Fri, Sep 21, 2007 at 02:10:55AM -0700, [email protected] wrote:
> Move the OOM killer's extern function prototypes to include/linux/oom.h and
> include it where necessary.
>
> Cc: Andrea Arcangeli <[email protected]>
> Acked-by: Christoph Lameter <[email protected]>

NAK. Target in corresponding Kbuild is wrong. sched.h is overkill.
Could we please also drop extern's while in protos?

> --- a/drivers/char/sysrq.c~oom-move-prototypes-to-appropriate-header-file
> +++ a/drivers/char/sysrq.c
> @@ -36,6 +36,7 @@
> #include <linux/kexec.h>
> #include <linux/irq.h>
> #include <linux/hrtimer.h>
> +#include <linux/oom.h>
>
> #include <asm/ptrace.h>
> #include <asm/irq_regs.h>
> diff -puN include/linux/oom.h~oom-move-prototypes-to-appropriate-header-file include/linux/oom.h
> --- a/include/linux/oom.h~oom-move-prototypes-to-appropriate-header-file
> +++ a/include/linux/oom.h
> @@ -1,10 +1,19 @@
> #ifndef __INCLUDE_LINUX_OOM_H
> #define __INCLUDE_LINUX_OOM_H
>
> +#include <linux/sched.h>
> +
> /* /proc/<pid>/oom_adj set to -17 protects from the oom-killer */
> #define OOM_DISABLE (-17)
> /* inclusive */
> #define OOM_ADJUST_MIN (-16)
> #define OOM_ADJUST_MAX 15
>
> -#endif
> +#ifdef __KERNEL__
> +
> +extern void out_of_memory(struct zonelist *zonelist, gfp_t gfp_mask, int order);
> +extern int register_oom_notifier(struct notifier_block *nb);
> +extern int unregister_oom_notifier(struct notifier_block *nb);


2007-09-21 19:38:28

by David Rientjes

[permalink] [raw]
Subject: Re: + oom-move-prototypes-to-appropriate-header-file.patch added to -mm tree

On Fri, 21 Sep 2007, Alexey Dobriyan wrote:

> > Move the OOM killer's extern function prototypes to include/linux/oom.h and
> > include it where necessary.
> >
> > Cc: Andrea Arcangeli <[email protected]>
> > Acked-by: Christoph Lameter <[email protected]>
>
> NAK. Target in corresponding Kbuild is wrong. sched.h is overkill.
> Could we please also drop extern's while in protos?
>

I'll prevent including sched.h in a follow-up patchset that I'll be
posting soon (and you'll be Cc'd). Which Kbuild target are you referring
to?

2007-09-21 19:54:57

by Alexey Dobriyan

[permalink] [raw]
Subject: Re: + oom-move-prototypes-to-appropriate-header-file.patch added to -mm tree

On Fri, Sep 21, 2007 at 12:38:03PM -0700, David Rientjes wrote:
> On Fri, 21 Sep 2007, Alexey Dobriyan wrote:
>
> > > Move the OOM killer's extern function prototypes to include/linux/oom.h and
> > > include it where necessary.
> > >
> > > Cc: Andrea Arcangeli <[email protected]>
> > > Acked-by: Christoph Lameter <[email protected]>
> >
> > NAK. Target in corresponding Kbuild is wrong. sched.h is overkill.
> > Could we please also drop extern's while in protos?
> >
>
> I'll prevent including sched.h in a follow-up patchset that I'll be
> posting soon (and you'll be Cc'd). Which Kbuild target are you referring
> to?

It's header-y vs unifdef-y in include/linux/Kbuild. The former is for
plain headers exported to userspace as-is. The latter need preprocessing
to remove __KERNEL__, CONFIG_*, etc.

Since you're going to clutter oom.h with some purely internal protos,
preprocessing should be done as well ;-)

2007-09-21 20:07:58

by Robert P. J. Day

[permalink] [raw]
Subject: Re: + oom-move-prototypes-to-appropriate-header-file.patch added to -mm tree

On Fri, 21 Sep 2007, Alexey Dobriyan wrote:

> On Fri, Sep 21, 2007 at 12:38:03PM -0700, David Rientjes wrote:
> > On Fri, 21 Sep 2007, Alexey Dobriyan wrote:
> >
> > > > Move the OOM killer's extern function prototypes to include/linux/oom.h and
> > > > include it where necessary.
> > > >
> > > > Cc: Andrea Arcangeli <[email protected]>
> > > > Acked-by: Christoph Lameter <[email protected]>
> > >
> > > NAK. Target in corresponding Kbuild is wrong. sched.h is overkill.
> > > Could we please also drop extern's while in protos?
> > >
> >
> > I'll prevent including sched.h in a follow-up patchset that I'll be
> > posting soon (and you'll be Cc'd). Which Kbuild target are you referring
> > to?
>
> It's header-y vs unifdef-y in include/linux/Kbuild. The former is
> for plain headers exported to userspace as-is. The latter need
> preprocessing to remove __KERNEL__, CONFIG_*, etc.

AFAIK, the only preprocessing that's removed is "__KERNEL__".

rday
--
========================================================================
Robert P. J. Day
Linux Consulting, Training and Annoying Kernel Pedantry
Waterloo, Ontario, CANADA

http://crashcourse.ca
========================================================================