Arjan van de Ven <[EMAIL PROTECTED]> writes: >> > >> > Its not that cheap. The ChangeLog included my own numbers, on a >> > Pentium M machine. (i686, 1.6 GHz, 1.5 GB ram) >> > >> > Without "if (need_resched())" (so calling need_resched() X.XXX.XXX >> > times), each run takes 88ms >> > >> > With the extra check (and *much* less function calls), each run >> > takes 25ms
ms?!? The numbers sound wrong. Wrong unit? >> > >> >> Looking at cond_resched(), I think the extra cost comes from >> "mov %esp,%edx ; and $0xffffe000,%edx" (current_thread_info()) >> >> I dont have oprofile numbers yet, but I suspect CPU may have some >> delays to compute this pointer value, since %esp is probably 'busy' >> because of the preceding "call" > > yeah the explicit reference makes the stack pointer tracking engine do a > commit I suspect which then also creates a data dependency in the code > flow. > > however... this is likely a good argument for making cond_resched() as a > whole a #define (or inline) that does this test and then calls the out > of line code (which then doesn't need to retest, so it avoids the > double test)... Disadvantage would be that might_sleep would be commonly skipped then (unless you actually need to reschedule) But perhaps that's not a big issue. -Andi - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/