public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH][TRIVIAL] Allocate kprobe_table at runtime
@ 2005-06-26 18:30 Jeff Sipek
  2005-06-27  5:51 ` Prasanna S Panchamukhi
  0 siblings, 1 reply; 3+ messages in thread
From: Jeff Sipek @ 2005-06-26 18:30 UTC (permalink / raw)
  To: Linux Kernel Mailing List; +Cc: trivial

[-- Attachment #1: Type: text/plain, Size: 883 bytes --]

Allocates kprobe_table at runtime.

Signed-off-by: Josef "Jeff" Sipek <jeffpc@optonline.net>


diff --git a/kernel/kprobes.c b/kernel/kprobes.c
--- a/kernel/kprobes.c
+++ b/kernel/kprobes.c
@@ -40,7 +40,7 @@
 #define KPROBE_HASH_BITS 6
 #define KPROBE_TABLE_SIZE (1 << KPROBE_HASH_BITS)
 
-static struct hlist_head kprobe_table[KPROBE_TABLE_SIZE];
+static struct hlist_head *kprobe_table;
 
 unsigned int kprobe_cpu = NR_CPUS;
 static DEFINE_SPINLOCK(kprobe_lock);
@@ -261,7 +261,10 @@ static int __init init_kprobes(void)
 {
 	int i, err = 0;
 
-	/* FIXME allocate the probe table, currently defined statically */
+	kprobe_table = kmalloc(sizeof(struct hlist_head)*KPROBE_TABLE_SIZE, GFP_ATOMIC);
+	if (!kprobe_table)
+		return -ENOMEM;
+
 	/* initialize all list heads */
 	for (i = 0; i < KPROBE_TABLE_SIZE; i++)
 		INIT_HLIST_HEAD(&kprobe_table[i]);

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH][TRIVIAL] Allocate kprobe_table at runtime
  2005-06-26 18:30 [PATCH][TRIVIAL] Allocate kprobe_table at runtime Jeff Sipek
@ 2005-06-27  5:51 ` Prasanna S Panchamukhi
  0 siblings, 0 replies; 3+ messages in thread
From: Prasanna S Panchamukhi @ 2005-06-27  5:51 UTC (permalink / raw)
  To: Jeff Sipek; +Cc: Linux Kernel Mailing List, trivial

Jeff,

On Sun, Jun 26, 2005 at 06:37:29PM +0000, Jeff Sipek wrote:
> Allocates kprobe_table at runtime.
> -	/* FIXME allocate the probe table, currently defined statically */
> +	kprobe_table = kmalloc(sizeof(struct hlist_head)*KPROBE_TABLE_SIZE, GFP_ATOMIC);

Memory allocation using GFP_KERNEL has more chances of success as compared to
GFP_ATOMIC. Why can't we use GFP_KERNEL here?

Thanks
Prasanna

-- 

Prasanna S Panchamukhi
Linux Technology Center
India Software Labs, IBM Bangalore
Ph: 91-80-25044636
<prasanna@in.ibm.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH][TRIVIAL] Allocate kprobe_table at runtime
       [not found] ` <20050627055150.GA10659@in.ibm.com.suse.lists.linux.kernel>
@ 2005-06-27  6:14   ` Andi Kleen
  0 siblings, 0 replies; 3+ messages in thread
From: Andi Kleen @ 2005-06-27  6:14 UTC (permalink / raw)
  To: Prasanna S Panchamukhi; +Cc: jeffpc, linux-kernel

Prasanna S Panchamukhi <prasanna@in.ibm.com> writes:

> Jeff,
> 
> On Sun, Jun 26, 2005 at 06:37:29PM +0000, Jeff Sipek wrote:
> > Allocates kprobe_table at runtime.
> > -	/* FIXME allocate the probe table, currently defined statically */
> > +	kprobe_table = kmalloc(sizeof(struct hlist_head)*KPROBE_TABLE_SIZE, GFP_ATOMIC);
> 
> Memory allocation using GFP_KERNEL has more chances of success as compared to
> GFP_ATOMIC. Why can't we use GFP_KERNEL here?

I don't see any sense in the change anyways. Just using BSS 
should be fine.

Jeff, when you submit a patch you should add a small blurb
describing why you think it is a good idea.

-Andi

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2005-06-27  6:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-06-26 18:30 [PATCH][TRIVIAL] Allocate kprobe_table at runtime Jeff Sipek
2005-06-27  5:51 ` Prasanna S Panchamukhi
     [not found] <20050626183049.GA22898@optonline.net.suse.lists.linux.kernel>
     [not found] ` <20050627055150.GA10659@in.ibm.com.suse.lists.linux.kernel>
2005-06-27  6:14   ` Andi Kleen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox