[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <b170af451002270152u228a46abr3b316da75b2fa3f0@mail.gmail.com>
Date: Sat, 27 Feb 2010 10:52:09 +0100
From: Rafał Miłecki <zajec5@...il.com>
To: Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: schedule (wait_event) vs. while
In radeon engine reclocking code I need to do some calculations and
then wait for VBLANK interrupt. Right after VBLANK interrupt will
happen I need to reclock ASAP.
Interrupts are received by another context and I need some quite fast
synchronization.
1) Schedule solution:
reclocking() {
calculations();
radeon->vblank_sync = 0;
wait_event_timeout(radeon->wq, radeon->vblank_sync, timeout);
reclock();
}
i-handler() { radeon->vblank_sync = 1; }
2) While solution:
reclocking() {
calculations();
del_timer(radeon->fake_vblank);
radeon->vblank_sync = 0;
mod_timer(radeon->fake_vblank, 10ms);
while(!radeon->vblank_sync);
reclock();
}
i-handler() { radeon->vblank_sync = 1; }
fake-handler() { radeon->vblank_sync = 1; }
Of course first one is much cleaner but internally wait_event_timeout
uses schedule_timeout(). Now according to LDD3:
> Once a process releases the processor with schedule, there are no guarantees that the process will get the processor back anytime soon. Therefore, calling schedule in this manner is not a safe solution to the driver’s needs, in addition to being bad for the computing system as a whole. If you test jitsched while running load50, you can see that the delay associated to each line is extended by a few seconds, because other processes are using the CPU when the timeout expires.
I can not afford any delays because VBLANK is so short timeframe. Is
there any better solution?
--
Rafał
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists