RE: [PATCH RFC] smt nice introduces significant lock contention

From: Chen, Kenneth W
Date: Fri Jun 02 2006 - 04:37:38 EST


Nick Piggin wrote on Friday, June 02, 2006 12:53 AM
> Con Kolivas wrote:
>
> >>Nice to acknowledge Chris's idea for
> >>trylocks in your changelog when you submit a final patch.
> >
> >
> > I absolutely would and I would ask for him to sign off on it as well, once we
> > agreed on a final form.
>
> This is a small micro-optimisation / cleanup we can do after
> smtnice gets converted to use trylocks. Might result in a little
> less cacheline footprint in some cases.


Just to pile up more micro-optimization: kernel can break out of the
for_each_domain loop when it hits first SD_SHARE_CPUPOWER.

- Ken


Signed-off-by: Ken Chen <kenneth.w.chen@xxxxxxxxx>


--- ./kernel/sched.c.orig 2006-06-01 23:14:47.000000000 -0700
+++ ./kernel/sched.c 2006-06-01 23:18:07.000000000 -0700
@@ -2780,8 +2780,10 @@ static int dependent_sleeper(int this_cp
int ret = 0, i;

for_each_domain(this_cpu, tmp)
- if (tmp->flags & SD_SHARE_CPUPOWER)
+ if (tmp->flags & SD_SHARE_CPUPOWER) {
sd = tmp;
+ break;
+ }

if (!sd)
return 0;

-
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/