diff options
| author | Thomas Zimmermann <tzimmermann@suse.de> | 2021-12-17 11:33:33 +0100 | 
|---|---|---|
| committer | Thomas Zimmermann <tzimmermann@suse.de> | 2021-12-17 11:33:33 +0100 | 
| commit | 1758047057dbe329be712a31b79db7151b5871f8 (patch) | |
| tree | 00203eb55328f2feda70b3d37c964287b364796f /kernel/cgroup/misc.c | |
| parent | bcae3af286f49bf4f6cda03f165fbe530f4a6bed (diff) | |
| parent | 1c405ca11bf563de1725e5ecfb4a74ee289d2ee9 (diff) | |
Merge drm/drm-next into drm-misc-next-fixes
Backmerging to bring drm-misc-next-fixes up to the latest state for
the current release cycle.
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Diffstat (limited to 'kernel/cgroup/misc.c')
| -rw-r--r-- | kernel/cgroup/misc.c | 31 | 
1 files changed, 24 insertions, 7 deletions
| diff --git a/kernel/cgroup/misc.c b/kernel/cgroup/misc.c index ec02d963cad1..fe3e8a0eb7ed 100644 --- a/kernel/cgroup/misc.c +++ b/kernel/cgroup/misc.c @@ -157,13 +157,6 @@ int misc_cg_try_charge(enum misc_res_type type, struct misc_cg *cg,  		new_usage = atomic_long_add_return(amount, &res->usage);  		if (new_usage > READ_ONCE(res->max) ||  		    new_usage > READ_ONCE(misc_res_capacity[type])) { -			if (!res->failed) { -				pr_info("cgroup: charge rejected by the misc controller for %s resource in ", -					misc_res_name[type]); -				pr_cont_cgroup_path(i->css.cgroup); -				pr_cont("\n"); -				res->failed = true; -			}  			ret = -EBUSY;  			goto err_charge;  		} @@ -171,6 +164,11 @@ int misc_cg_try_charge(enum misc_res_type type, struct misc_cg *cg,  	return 0;  err_charge: +	for (j = i; j; j = parent_misc(j)) { +		atomic_long_inc(&j->res[type].events); +		cgroup_file_notify(&j->events_file); +	} +  	for (j = cg; j != i; j = parent_misc(j))  		misc_cg_cancel_charge(type, j, amount);  	misc_cg_cancel_charge(type, i, amount); @@ -335,6 +333,19 @@ static int misc_cg_capacity_show(struct seq_file *sf, void *v)  	return 0;  } +static int misc_events_show(struct seq_file *sf, void *v) +{ +	struct misc_cg *cg = css_misc(seq_css(sf)); +	unsigned long events, i; + +	for (i = 0; i < MISC_CG_RES_TYPES; i++) { +		events = atomic_long_read(&cg->res[i].events); +		if (READ_ONCE(misc_res_capacity[i]) || events) +			seq_printf(sf, "%s.max %lu\n", misc_res_name[i], events); +	} +	return 0; +} +  /* Misc cgroup interface files */  static struct cftype misc_cg_files[] = {  	{ @@ -353,6 +364,12 @@ static struct cftype misc_cg_files[] = {  		.seq_show = misc_cg_capacity_show,  		.flags = CFTYPE_ONLY_ON_ROOT,  	}, +	{ +		.name = "events", +		.flags = CFTYPE_NOT_ON_ROOT, +		.file_offset = offsetof(struct misc_cg, events_file), +		.seq_show = misc_events_show, +	},  	{}  }; | 
