Skip to content

Commit

Permalink
Merge branch '6.11/prjc' into 6.11/main
Browse files Browse the repository at this point in the history
Add changes from Project-C 6.12:
 - sched/alt: Simpifly migrate_enable/disable design.
  • Loading branch information
damentz committed Nov 15, 2024
2 parents 1773c45 + 5c12e9a commit c9a9b55
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
4 changes: 4 additions & 0 deletions include/linux/sched.h
Original file line number Diff line number Diff line change
Expand Up @@ -874,11 +874,15 @@ struct task_struct {
const cpumask_t *cpus_ptr;
cpumask_t *user_cpus_ptr;
cpumask_t cpus_mask;
#ifndef CONFIG_SCHED_ALT
void *migration_pending;
#endif
#ifdef CONFIG_SMP
unsigned short migration_disabled;
#endif
#ifndef CONFIG_SCHED_ALT
unsigned short migration_flags;
#endif

#ifdef CONFIG_PREEMPT_RCU
int rcu_read_lock_nesting;
Expand Down
12 changes: 0 additions & 12 deletions kernel/sched/alt_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1438,8 +1438,6 @@ void set_task_cpu(struct task_struct *p, unsigned int new_cpu)
__set_task_cpu(p, new_cpu);
}

#define MDF_FORCE_ENABLED 0x80

static void
__do_set_cpus_ptr(struct task_struct *p, const struct cpumask *new_mask)
{
Expand Down Expand Up @@ -1474,8 +1472,6 @@ void migrate_disable(void)
if (cpumask_test_cpu(cpu, &p->cpus_mask)) {
cpu_rq(cpu)->nr_pinned++;
p->migration_disabled = 1;
p->migration_flags &= ~MDF_FORCE_ENABLED;

/*
* Violates locking rules! see comment in __do_set_cpus_ptr().
*/
Expand Down Expand Up @@ -1505,10 +1501,6 @@ void migrate_enable(void)
* __set_cpus_allowed_ptr(SCA_MIGRATE_ENABLE) doesn't schedule().
*/
guard(preempt)();
/*
* Assumption: current should be running on allowed cpu
*/
WARN_ON_ONCE(!cpumask_test_cpu(smp_processor_id(), &p->cpus_mask));
if (p->cpus_ptr != &p->cpus_mask)
__do_set_cpus_ptr(p, &p->cpus_mask);
/*
Expand Down Expand Up @@ -2004,7 +1996,6 @@ static int affine_move_task(struct rq *rq, struct task_struct *p, int dest_cpu,
if (likely(p->cpus_ptr != &p->cpus_mask))
__do_set_cpus_ptr(p, &p->cpus_mask);
p->migration_disabled = 0;
p->migration_flags |= MDF_FORCE_ENABLED;
/* When p is migrate_disabled, rq->lock should be held */
rq->nr_pinned--;
}
Expand Down Expand Up @@ -6461,9 +6452,6 @@ void __cant_migrate(const char *file, int line)
if (preempt_count() > 0)
return;

if (current->migration_flags & MDF_FORCE_ENABLED)
return;

if (time_before(jiffies, prev_jiffy + HZ) && prev_jiffy)
return;
prev_jiffy = jiffies;
Expand Down

0 comments on commit c9a9b55

Please sign in to comment.