Skip to content

Commit e4e149d

Browse files
committed
sched_ext: Merge branch 'for-6.16-fixes' into for-6.17
Pull sched_ext/for-6.16-fixes to receive: c50784e ("sched_ext: Make scx_group_set_weight() always update tg->scx.weight") 33796b9 ("sched_ext, sched/core: Don't call scx_group_set_weight() prematurely from sched_create_group()") which are needed to implement CPU bandwidth control interface support. Signed-off-by: Tejun Heo <[email protected]>
2 parents e4ee150 + 33796b9 commit e4e149d

File tree

10 files changed

+37
-17
lines changed

10 files changed

+37
-17
lines changed

MAINTAINERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22171,7 +22171,7 @@ R: Tejun Heo <[email protected]>
2217122171
R: David Vernet <[email protected]>
2217222172
R: Andrea Righi <[email protected]>
2217322173
R: Changwoo Min <[email protected]>
22174-
22174+
2217522175
S: Maintained
2217622176
W: https://github.com/sched-ext/scx
2217722177
T: git://git.kernel.org/pub/scm/linux/kernel/git/tj/sched_ext.git

arch/powerpc/platforms/book3s/vas-api.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -521,6 +521,15 @@ static int coproc_mmap(struct file *fp, struct vm_area_struct *vma)
521521
return -EINVAL;
522522
}
523523

524+
/*
525+
* Map complete page to the paste address. So the user
526+
* space should pass 0ULL to the offset parameter.
527+
*/
528+
if (vma->vm_pgoff) {
529+
pr_debug("Page offset unsupported to map paste address\n");
530+
return -EINVAL;
531+
}
532+
524533
/* Ensure instance has an open send window */
525534
if (!txwin) {
526535
pr_err("No send window open?\n");

arch/powerpc/platforms/powernv/memtrace.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,15 @@ static ssize_t memtrace_read(struct file *filp, char __user *ubuf,
4848
static int memtrace_mmap(struct file *filp, struct vm_area_struct *vma)
4949
{
5050
struct memtrace_entry *ent = filp->private_data;
51+
unsigned long ent_nrpages = ent->size >> PAGE_SHIFT;
52+
unsigned long vma_nrpages = vma_pages(vma);
5153

52-
if (ent->size < vma->vm_end - vma->vm_start)
54+
/* The requested page offset should be within object's page count */
55+
if (vma->vm_pgoff >= ent_nrpages)
5356
return -EINVAL;
5457

55-
if (vma->vm_pgoff << PAGE_SHIFT >= ent->size)
58+
/* The requested mapping range should remain within the bounds */
59+
if (vma_nrpages > ent_nrpages - vma->vm_pgoff)
5660
return -EINVAL;
5761

5862
vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);

include/linux/key.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ struct key {
236236
#define KEY_FLAG_ROOT_CAN_INVAL 7 /* set if key can be invalidated by root without permission */
237237
#define KEY_FLAG_KEEP 8 /* set if key should not be removed */
238238
#define KEY_FLAG_UID_KEYRING 9 /* set if key is a user or user session keyring */
239-
#define KEY_FLAG_FINAL_PUT 10 /* set if final put has happened on key */
239+
#define KEY_FLAG_USER_ALIVE 10 /* set if final put has not happened on key yet */
240240

241241
/* the key type and key description string
242242
* - the desc is used to match a key against search criteria

kernel/sched/core.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8437,7 +8437,7 @@ void __init sched_init(void)
84378437
init_cfs_bandwidth(&root_task_group.cfs_bandwidth, NULL);
84388438
#endif /* CONFIG_FAIR_GROUP_SCHED */
84398439
#ifdef CONFIG_EXT_GROUP_SCHED
8440-
root_task_group.scx_weight = CGROUP_WEIGHT_DFL;
8440+
scx_tg_init(&root_task_group);
84418441
#endif /* CONFIG_EXT_GROUP_SCHED */
84428442
#ifdef CONFIG_RT_GROUP_SCHED
84438443
root_task_group.rt_se = (struct sched_rt_entity **)ptr;
@@ -8872,7 +8872,7 @@ struct task_group *sched_create_group(struct task_group *parent)
88728872
if (!alloc_rt_sched_group(tg, parent))
88738873
goto err;
88748874

8875-
scx_group_set_weight(tg, CGROUP_WEIGHT_DFL);
8875+
scx_tg_init(tg);
88768876
alloc_uclamp_sched_group(tg, parent);
88778877

88788878
return tg;

kernel/sched/ext.c

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4056,6 +4056,11 @@ bool scx_can_stop_tick(struct rq *rq)
40564056
DEFINE_STATIC_PERCPU_RWSEM(scx_cgroup_rwsem);
40574057
static bool scx_cgroup_enabled;
40584058

4059+
void scx_tg_init(struct task_group *tg)
4060+
{
4061+
tg->scx_weight = CGROUP_WEIGHT_DFL;
4062+
}
4063+
40594064
int scx_tg_online(struct task_group *tg)
40604065
{
40614066
struct scx_sched *sch = scx_root;
@@ -4205,12 +4210,12 @@ void scx_group_set_weight(struct task_group *tg, unsigned long weight)
42054210

42064211
percpu_down_read(&scx_cgroup_rwsem);
42074212

4208-
if (scx_cgroup_enabled && tg->scx_weight != weight) {
4209-
if (SCX_HAS_OP(sch, cgroup_set_weight))
4210-
SCX_CALL_OP(sch, SCX_KF_UNLOCKED, cgroup_set_weight, NULL,
4211-
tg_cgrp(tg), weight);
4212-
tg->scx_weight = weight;
4213-
}
4213+
if (scx_cgroup_enabled && SCX_HAS_OP(sch, cgroup_set_weight) &&
4214+
tg->scx_weight != weight)
4215+
SCX_CALL_OP(sch, SCX_KF_UNLOCKED, cgroup_set_weight, NULL,
4216+
tg_cgrp(tg), weight);
4217+
4218+
tg->scx_weight = weight;
42144219

42154220
percpu_up_read(&scx_cgroup_rwsem);
42164221
}

kernel/sched/ext.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ static inline void scx_update_idle(struct rq *rq, bool idle, bool do_notify) {}
9595

9696
#ifdef CONFIG_CGROUP_SCHED
9797
#ifdef CONFIG_EXT_GROUP_SCHED
98+
void scx_tg_init(struct task_group *tg);
9899
int scx_tg_online(struct task_group *tg);
99100
void scx_tg_offline(struct task_group *tg);
100101
int scx_cgroup_can_attach(struct cgroup_taskset *tset);
@@ -104,6 +105,7 @@ void scx_cgroup_cancel_attach(struct cgroup_taskset *tset);
104105
void scx_group_set_weight(struct task_group *tg, unsigned long cgrp_weight);
105106
void scx_group_set_idle(struct task_group *tg, bool idle);
106107
#else /* CONFIG_EXT_GROUP_SCHED */
108+
static inline void scx_tg_init(struct task_group *tg) {}
107109
static inline int scx_tg_online(struct task_group *tg) { return 0; }
108110
static inline void scx_tg_offline(struct task_group *tg) {}
109111
static inline int scx_cgroup_can_attach(struct cgroup_taskset *tset) { return 0; }

mm/damon/Kconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ menu "Data Access Monitoring"
44

55
config DAMON
66
bool "DAMON: Data Access Monitoring Framework"
7-
default y
87
help
98
This builds a framework that allows kernel subsystems to monitor
109
access frequency of each memory region. The information can be useful

security/keys/gc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,8 +218,8 @@ static void key_garbage_collector(struct work_struct *work)
218218
key = rb_entry(cursor, struct key, serial_node);
219219
cursor = rb_next(cursor);
220220

221-
if (test_bit(KEY_FLAG_FINAL_PUT, &key->flags)) {
222-
smp_mb(); /* Clobber key->user after FINAL_PUT seen. */
221+
if (!test_bit_acquire(KEY_FLAG_USER_ALIVE, &key->flags)) {
222+
/* Clobber key->user after final put seen. */
223223
goto found_unreferenced_key;
224224
}
225225

security/keys/key.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,7 @@ struct key *key_alloc(struct key_type *type, const char *desc,
298298
key->restrict_link = restrict_link;
299299
key->last_used_at = ktime_get_real_seconds();
300300

301+
key->flags |= 1 << KEY_FLAG_USER_ALIVE;
301302
if (!(flags & KEY_ALLOC_NOT_IN_QUOTA))
302303
key->flags |= 1 << KEY_FLAG_IN_QUOTA;
303304
if (flags & KEY_ALLOC_BUILT_IN)
@@ -658,8 +659,8 @@ void key_put(struct key *key)
658659
key->user->qnbytes -= key->quotalen;
659660
spin_unlock_irqrestore(&key->user->lock, flags);
660661
}
661-
smp_mb(); /* key->user before FINAL_PUT set. */
662-
set_bit(KEY_FLAG_FINAL_PUT, &key->flags);
662+
/* Mark key as safe for GC after key->user done. */
663+
clear_bit_unlock(KEY_FLAG_USER_ALIVE, &key->flags);
663664
schedule_work(&key_gc_work);
664665
}
665666
}

0 commit comments

Comments
 (0)