Linux-kernel mailing list archive 1998-31,: Re: problem with 114 sched.* changes (not the gcc one)

# Re: problem with 114 sched.* changes (not the gcc one)

Ion Badulescu (ionut@moisil.cs.columbia.edu)
Sat, 8 Aug 1998 03:22:34 -0400

- Messages sorted by: [ date ][ thread ][ subject ][ author ]
- Next message: Joseph Malicki: "Re: [Fwd: [PATCH] [SECURITY] suid procs exec'd with bad 0,1,2 fds]"
- Previous message: Andrew Derrick Balsa: "Re: 6x86 recognition"

[duh.. of *course* I forgot to attach the file... silly me]

Ion

    --
      It is better to keep your mouth shut and be thought a fool,
                than to open it and remove all doubt.
    -------------------------------------
    diff -u --recursive --new-file v2.1.113/linux/kernel/sched.c linux/kernel/sched.c
    --- v2.1.113/linux/kernel/sched.c	Tue Jul 28 14:21:10 1998
    +++ linux/kernel/sched.c	Mon Aug  3 11:27:32 1998
    @@ -146,14 +146,21 @@
     		current->need_resched = 1;
     }

    -
    +/*
    + * Careful!
    + *
    + * This has to add the process to the _beginning_ of the
    + * run-queue, not the end. See the comment about "This is
    + * subtle" in the scheduler proper..
    + */
     static inline void add_to_runqueue(struct task_struct * p)
     {
    -	nr_running++;
    -	reschedule_idle(p);
    -	(p->prev_run = init_task.prev_run)->next_run = p;
    -	p->next_run = &init_task;
    -	init_task.prev_run = p;
    +	struct task_struct *next = init_task.next_run;
    +
    +	p->prev_run = &init_task;
    +	init_task.next_run = p;
    +	p->next_run = next;
    +	next->prev_run = p;
     }

     static inline void del_from_runqueue(struct task_struct * p)
    @@ -229,8 +236,11 @@

     	spin_lock_irqsave(&runqueue_lock, flags);
     	p->state = TASK_RUNNING;
    -	if (!p->next_run)
    +	if (!p->next_run) {
     		add_to_runqueue(p);
    +		reschedule_idle(p);
    +		nr_running++;
    +	}
     	spin_unlock_irqrestore(&runqueue_lock, flags);
     }

    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.rutgers.edu
    Please read the FAQ at http://www.altern.org/andrebalsa/doc/lkml-faq.html

- Next message: Joseph Malicki: "Re: [Fwd: [PATCH] [SECURITY] suid procs exec'd with bad 0,1,2 fds]"
- Previous message: Andrew Derrick Balsa: "Re: 6x86 recognition"