aboutsummaryrefslogblamecommitdiffstats
path: root/litmus/litmus_pai_softirq.c
blob: 1ee5f73a29918957a604128600ac625bc69935fe (plain) (tree)


















                                  


















                                                                                   


                                                                          
     







                                                                            
                    



                            































                                                                                   
#include <linux/interrupt.h>
#include <linux/percpu.h>
#include <linux/cpu.h>
#include <linux/kthread.h>
#include <linux/ftrace.h>
#include <linux/smp.h>
#include <linux/slab.h>
#include <linux/mutex.h>

#include <linux/sched.h>
#include <linux/cpuset.h>

#include <litmus/litmus.h>
#include <litmus/sched_trace.h>
#include <litmus/jobs.h>
#include <litmus/sched_plugin.h>
#include <litmus/litmus_softirq.h>


static void __do_lit_tasklet(struct tasklet_struct* tasklet)
{
	if (!atomic_read(&tasklet->count)) {
		if (!test_and_clear_bit(TASKLET_STATE_SCHED, &tasklet->state))
		{
			BUG();
		}
		TRACE("%s: Invoking tasklet with owner pid = %d (flushed = %d).\n",
			  __FUNCTION__,
			  (tasklet->owner) ? tasklet->owner->pid : -1,
			  (tasklet->owner) ? 0 : 1);
		tasklet->func(tasklet->data);
		tasklet_unlock(tasklet);
	}
	else {
		BUG();
	}
}


int __litmus_tasklet_schedule(struct tasklet_struct *t, unsigned int k_id)
{
#if 0
	int ret = 0; /* assume failure */
    if(unlikely((t->owner == NULL) || !is_realtime(t->owner)))
    {
        TRACE("%s: No owner associated with this tasklet!\n", __FUNCTION__);
        BUG();
    }

    ret = litmus->enqueue_pai_tasklet(t);
	return(ret);
#else
	__do_lit_tasklet(t);
	return(1);
#endif
}

EXPORT_SYMBOL(__litmus_tasklet_schedule);



// failure causes default Linux handling.
int __litmus_tasklet_hi_schedule(struct tasklet_struct *t, unsigned int k_id)
{
	int ret = 0; /* assume failure */
	return(ret);
}
EXPORT_SYMBOL(__litmus_tasklet_hi_schedule);


// failure causes default Linux handling.
int __litmus_tasklet_hi_schedule_first(struct tasklet_struct *t, unsigned int k_id)
{
	int ret = 0; /* assume failure */
	return(ret);
}
EXPORT_SYMBOL(__litmus_tasklet_hi_schedule_first);


// failure causes default Linux handling.
int __litmus_schedule_work(struct work_struct *w, unsigned int k_id)
{
	int ret = 0; /* assume failure */
	return(ret);
}
EXPORT_SYMBOL(__litmus_schedule_work);