questions on calc_delta_mine() in sched.c

From: Joel Schopp
Date: Thu May 01 2008 - 16:46:00 EST


Ingo,

I have a few questions regarding this code in kernel/sched.c

static unsigned long
calc_delta_mine(unsigned long delta_exec, unsigned long weight,
struct load_weight *lw)
{
u64 tmp;

if (unlikely(!lw->inv_weight))
lw->inv_weight = (WMULT_CONST-lw->weight/2) / (lw->weight+1);


Q1) This code is hit often in scenarios I run, is this really unlikely for others?
Q2) The rest of the code in sched.c seems to make inv_weight == WMULT_CONST/weight and I was wondering if you could explain why this instance is different.
Q3) That division is pretty expensive, could we sacrifice some accuracy and do a precompute table? Do you have another idea how we could get rid of the divide?

-Joel Schopp

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