Re: Realtime Preemption, 2.6.12, Beginners Guide?

From: Ingo Molnar
Date: Sat Jul 09 2005 - 08:15:16 EST



> (gdb) ####################################
> (gdb) # c02decd6, stack size: 460 bytes #
> (gdb) ####################################
> (gdb) 0xc02decd6 is in ip_getsockopt (net/ipv4/ip_sockglue.c:877).

----
this patch reduces the stack footprint of ip_getsockopt() from 460 bytes
to 188 bytes. (note: needs review & testing because i did not excercise
this multicast codepath.)

Signed-off-by: Ingo Molnar <mingo@xxxxxxx>

Index: linux/net/ipv4/ip_sockglue.c
===================================================================
--- linux.orig/net/ipv4/ip_sockglue.c
+++ linux/net/ipv4/ip_sockglue.c
@@ -1006,20 +1024,28 @@ int ip_getsockopt(struct sock *sk, int l
}
case MCAST_MSFILTER:
{
- struct group_filter gsf;
+ struct group_filter *gsf;
int err;

+ gsf = kmalloc(sizeof(*gsf), GFP_KERNEL);
+ if (!gsf) {
+ release_sock(sk);
+ return -ENOMEM;
+ }
if (len < GROUP_FILTER_SIZE(0)) {
release_sock(sk);
+ kfree(gsf);
return -EINVAL;
}
- if (copy_from_user(&gsf, optval, GROUP_FILTER_SIZE(0))) {
+ if (copy_from_user(gsf, optval, GROUP_FILTER_SIZE(0))) {
release_sock(sk);
+ kfree(gsf);
return -EFAULT;
}
- err = ip_mc_gsfget(sk, &gsf,
+ err = ip_mc_gsfget(sk, gsf,
(struct group_filter __user *)optval, optlen);
release_sock(sk);
+ kfree(gsf);
return err;
}
case IP_PKTOPTIONS:
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/