mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hans Rosenfeld <hans.rosenfeld@amd.com>
To: <hpa@zytor.com>
Cc: <brgerst@gmail.com>, <tglx@linutronix.de>, <mingo@elte.hu>,
	<suresh.b.siddha@intel.com>, <eranian@google.com>,
	<robert.richter@amd.com>, <Andreas.Herrmann3@amd.com>,
	<x86@kernel.org>, <linux-kernel@vger.kernel.org>,
	Hans Rosenfeld <hans.rosenfeld@amd.com>
Subject: [PATCH 2/2] fork: avoid weak function arch_dup_task_struct
Date: Wed, 27 Apr 2011 16:26:35 +0200	[thread overview]
Message-ID: <1303914395-841373-2-git-send-email-hans.rosenfeld@amd.com> (raw)
In-Reply-To: <2be7032a-e4b6-4ce7-af53-532d77dbfb48@email.android.com>

Avoid potential gcc bug by not using a weak function for
arch_dup_task_struct. Use an #ifdef'ed static function for
archs that don't have a special arch_dup_task_struct implementation.

Signed-off-by: Hans Rosenfeld <hans.rosenfeld@amd.com>
---
 arch/sh/include/asm/thread_info.h  |    1 +
 arch/x86/include/asm/thread_info.h |    1 +
 kernel/fork.c                      |    5 +++--
 3 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/arch/sh/include/asm/thread_info.h b/arch/sh/include/asm/thread_info.h
index ea2d508..2d27e1c 100644
--- a/arch/sh/include/asm/thread_info.h
+++ b/arch/sh/include/asm/thread_info.h
@@ -100,6 +100,7 @@ extern void free_thread_info(struct thread_info *ti);
 extern void arch_task_cache_init(void);
 #define arch_task_cache_init arch_task_cache_init
 extern int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src);
+#define arch_dup_task_struct arch_dup_task_struct
 extern void init_thread_xstate(void);
 
 #define __HAVE_ARCH_THREAD_INFO_ALLOCATOR
diff --git a/arch/x86/include/asm/thread_info.h b/arch/x86/include/asm/thread_info.h
index 07c8cfe..ce97947 100644
--- a/arch/x86/include/asm/thread_info.h
+++ b/arch/x86/include/asm/thread_info.h
@@ -266,6 +266,7 @@ extern void arch_task_cache_init(void);
 extern void free_thread_info(struct thread_info *ti);
 extern int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src);
 extern int arch_prealloc_fpu(struct task_struct *tsk);
+#define arch_dup_task_struct arch_dup_task_struct
 #define arch_prealloc_fpu arch_prealloc_fpu
 #define arch_task_cache_init arch_task_cache_init
 #endif
diff --git a/kernel/fork.c b/kernel/fork.c
index e7548de..6d929d0 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -243,12 +243,13 @@ void __init fork_init(unsigned long mempages)
 		init_task.signal->rlim[RLIMIT_NPROC];
 }
 
-int __attribute__((weak)) arch_dup_task_struct(struct task_struct *dst,
-					       struct task_struct *src)
+#ifndef arch_dup_task_struct
+static int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src)
 {
 	*dst = *src;
 	return 0;
 }
+#endif
 
 static struct task_struct *dup_task_struct(struct task_struct *orig)
 {
-- 
1.5.6.5



  parent reply	other threads:[~2011-04-27 14:26 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <2be7032a-e4b6-4ce7-af53-532d77dbfb48@email.android.com>
2011-04-27 14:26 ` [PATCH 1/2] x86, xsave: fix non-lazy allocation of the xsave area Hans Rosenfeld
2011-04-28  5:55   ` [tip:x86/xsave] " tip-bot for Hans Rosenfeld
2011-04-27 14:26 ` Hans Rosenfeld [this message]
2011-05-01 19:25   ` [PATCH 2/2] fork: avoid weak function arch_dup_task_struct Andrew Morton
2011-05-01 22:59     ` H. Peter Anvin
2011-05-02  0:11       ` Andrew Morton
2011-05-02 15:36         ` H. Peter Anvin

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=1303914395-841373-2-git-send-email-hans.rosenfeld@amd.com \
    --to=hans.rosenfeld@amd.com \
    --cc=Andreas.Herrmann3@amd.com \
    --cc=brgerst@gmail.com \
    --cc=eranian@google.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=robert.richter@amd.com \
    --cc=suresh.b.siddha@intel.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /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®