Sean MacLennan wrote: > Would cpu_relax be a good thing to put here? > > Something like: > > while (!(rc = (condition)) && (tb_ticks_since(__start) <= __loops)) \ > if (delay) \ > udelay(delay); \ > else \ > cpu_relax(); \ >
I had that at one point, but then I looked at the code for udelay(), and it appears that if I do udelay(0), it does something similar to cpu_relax: start = get_tbl(); while (get_tbl() - start < loops) HMT_low(); HMT_medium(); cpu_relax does this: do { HMT_low(); HMT_medium(); barrier(); } while (0) Well, now that I look at it, cpu_relax() changes the thread priority to low and then back to medium, whereas udelay() never sets it to low if 'loops' is 0. I'm okay with changing my code, but I wonder if udelay() should look like this: start = get_tbl(); HMT_low(); while (get_tbl() - start < loops) HMT_low(); HMT_medium(); -- Timur Tabi Linux kernel developer at Freescale _______________________________________________ Linuxppc-dev mailing list Linuxppc-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc-dev