summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
fff7936)
Signed-off-by: Pierre Habouzit <pierre.habouzit@intersec.com>
} else {
__pwqr_sb_update_state(sb, 0);
}
} else {
__pwqr_sb_update_state(sb, 0);
}
- pwqt->notifier.ops = &pwqr_preempt_noop_ops;
pwqr_sb_unlock_irqrestore(sb, flags);
pwqr_sb_put(sb);
pwqt->sb = NULL;
pwqr_sb_unlock_irqrestore(sb, flags);
pwqr_sb_put(sb);
pwqt->sb = NULL;
hlist_del(&pwqt->link);
spin_unlock(&b->lock);
#endif
hlist_del(&pwqt->link);
spin_unlock(&b->lock);
#endif
+ pwqt->notifier.ops = &pwqr_preempt_noop_ops;
if (from_notifier) {
/* When called from sched_{out,in}, it's not allowed to
if (from_notifier) {
/* When called from sched_{out,in}, it's not allowed to
}
static void pwqr_task_noop_sched_out(struct preempt_notifier *notifier,
}
static void pwqr_task_noop_sched_out(struct preempt_notifier *notifier,
- struct task_struct *next)
+ struct task_struct *next)
if (unlikely(sb->state < 0)) {
pwqr_task_detach(pwqt, sb);
if (unlikely(sb->state < 0)) {
pwqr_task_detach(pwqt, sb);
+ pwqr_task_release(pwqt, true);
if (unlikely(p->state & TASK_DEAD) || unlikely(sb->state < 0)) {
pwqr_task_detach(pwqt, sb);
if (unlikely(p->state & TASK_DEAD) || unlikely(sb->state < 0)) {
pwqr_task_detach(pwqt, sb);
- if (p->state & TASK_DEAD)
- pwqr_task_release(pwqt, true);
+ pwqr_task_release(pwqt, true);
return;
}
if (p->state == 0 || (p->state & (__TASK_STOPPED | __TASK_TRACED)))
return;
}
if (p->state == 0 || (p->state & (__TASK_STOPPED | __TASK_TRACED)))
#include <sched.h>
#include <stddef.h>
#include <stdint.h>
#include <sched.h>
#include <stddef.h>
#include <stdint.h>
#include <sys/ioctl.h>
#include <sys/poll.h>
#include <sys/time.h>
#include <sys/ioctl.h>
#include <sys/poll.h>
#include <sys/time.h>
static int pwqr_fd_g = -1;
static int pi_g;
static int pwqr_fd_g = -1;
static int pi_g;
-static void *thr_main(void *unused)
+#define trace(fmt, ...) fprintf(stderr, fmt"\n", ##__VA_ARGS__)
+
+static void *thr_main(void *_who)
+ int who = (long)_who;
+
if (pwqr_ctl(pwqr_fd_g, PWQR_CTL_REGISTER, 0, NULL) < 0)
if (pwqr_ctl(pwqr_fd_g, PWQR_CTL_REGISTER, 0, NULL) < 0)
- err(-1, "pwqr_ctl(PWQR_CTL_REGISTER)");
+ err(-1, "%d: pwqr_ctl(PWQR_CTL_REGISTER)", who);
+
+ /* busy-loop */
+ trace("%d: loop1", who);
+ do {
+ pthread_testcancel();
+ } while (!state_g);
+
+ trace("%d: tries to park", who);
+ if (pwqr_ctl(pwqr_fd_g, PWQR_CTL_PARK, 0, NULL) < 0)
+ trace("pwqr_ctl(PWQR_CTL_PARK)");
+ trace("%d: unparked", who);
+ trace("%d: loop2", who);
+ do {
struct timeval start, tv;
int rc;
struct timeval start, tv;
int rc;
pwqr_fd_g = pwqr_create(PWQR_FL_NONBLOCK);
if (pwqr_fd_g < 0)
err(-1, "pwqr_create");
pwqr_fd_g = pwqr_create(PWQR_FL_NONBLOCK);
if (pwqr_fd_g < 0)
err(-1, "pwqr_create");
err(-1, "pwqr_ctl(PWQR_CTL_GET_CONC)");
for (int i = 0; i < pi_g + 1; i++) {
err(-1, "pwqr_ctl(PWQR_CTL_GET_CONC)");
for (int i = 0; i < pi_g + 1; i++) {
- pthread_create(&tids[i], NULL, thr_main, NULL);
+ pthread_create(&tids[i], NULL, thr_main, (void *)(long)i);
warn("read");
} else {
gettimeofday(&tv, NULL);
warn("read");
} else {
gettimeofday(&tv, NULL);
- warnx("[%06jd.%06jd] overcommit of %d",
+ trace("[%06jd.%06jd] overcommit of %d",
tv_diff(&tv, &start) / 1000000,
tv_diff(&tv, &start) % 1000000, rc);
}
tv_diff(&tv, &start) / 1000000,
tv_diff(&tv, &start) % 1000000, rc);
}
}
if (pfd.revents & POLLHUP) {
errx(-1, "poll returned POLLHUP");
}
if (pfd.revents & POLLHUP) {
errx(-1, "poll returned POLLHUP");