mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Petr Mladek <pmladek@suse.com>
Cc: Ingo Molnar <mingo@redhat.com>,
	Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>,
	Andy Lutomirski <luto@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Thiago Macieira <thiago.macieira@intel.com>,
	Jiri Kosina <jkosina@suse.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] clone: Declare do_fork() only when available
Date: Wed, 23 Sep 2015 13:43:20 -0700	[thread overview]
Message-ID: <20150923134320.bae22a467a427c9c77c1da9e@linux-foundation.org> (raw)
In-Reply-To: <1443009569-1508-2-git-send-email-pmladek@suse.com>

On Wed, 23 Sep 2015 13:59:28 +0200 Petr Mladek <pmladek@suse.com> wrote:

> The commit 3033f14ab78c32687 ("clone: support passing tls argument via C
> rather than pt_regs magic") introduced _do_fork() that allowed to pass
> @tls parameter.
> 
> The old do_fork() is defined only for architectures that are not ready
> to use this way and do not define HAVE_COPY_THREAD_TLS. But the function
> is always declared in linux/sched.h.
> 
> This patch hides the declaration when the function is not defined.
> 
> ..
>
> --- a/include/linux/sched.h
> +++ b/include/linux/sched.h
> @@ -2618,7 +2618,9 @@ extern int do_execveat(int, struct filename *,
>  		       const char __user * const __user *,
>  		       int);
>  extern long _do_fork(unsigned long, unsigned long, unsigned long, int __user *, int __user *, unsigned long);
> +#ifndef CONFIG_HAVE_COPY_THREAD_TLS
>  extern long do_fork(unsigned long, unsigned long, unsigned long, int __user *, int __user *);
> +#endif

Generally we avoid adding such ifdefs.

Downside: a compile-time error is turned into a link-time error.  This
inconveniences a small number of people a small number of times.

Upside: cleaner-looking header files.  This benefits a larger number of
people a larger number of times.

So it's a good tradeoff, I think.

Now there may be some special reason why do_fork() is special.  If so,
you owe us a new changelog ;)


  reply	other threads:[~2015-09-23 20:43 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-23 11:59 [PATCH 0/2] clone/kprobe: Do not use do_fork() when not defined Petr Mladek
2015-09-23 11:59 ` [PATCH 1/2] clone: Declare do_fork() only when available Petr Mladek
2015-09-23 20:43   ` Andrew Morton [this message]
2015-09-23 11:59 ` [PATCH 2/2] kprobe: Use _do_fork() in samples to make them work again Petr Mladek

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=20150923134320.bae22a467a427c9c77c1da9e@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=hpa@zytor.com \
    --cc=jkosina@suse.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=masami.hiramatsu.pt@hitachi.com \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=pmladek@suse.com \
    --cc=tglx@linutronix.de \
    --cc=thiago.macieira@intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®