File bug-514127_libcpuset-cpuset_set_iopt-adds.patch of Package libcpuset

---
 libcpuset.c |   55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 55 insertions(+)

--- a/libcpuset.c
+++ b/libcpuset.c
@@ -67,9 +67,11 @@ struct cpuset {
 	char mem_exclusive;
 	char notify_on_release;
 	char memory_migrate;
+	char mem_hardwall;
 	char memory_pressure_enabled;
 	char memory_spread_page;
 	char memory_spread_slab;
+	char sched_load_balance;
 
 	/*
 	 * Each field 'x' above gets an 'x_valid' field below.
@@ -95,9 +97,11 @@ struct cpuset {
 	unsigned mem_exclusive_valid:1;
 	unsigned notify_on_release_valid:1;
 	unsigned memory_migrate_valid:1;
+	unsigned mem_hardwall_valid:1;
 	unsigned memory_pressure_enabled_valid:1;
 	unsigned memory_spread_page_valid:1;
 	unsigned memory_spread_slab_valid:1;
+	unsigned sched_load_balance_valid:1;
 };
 
 /* Presumed cpuset file system mount point */
@@ -688,12 +692,18 @@ int cpuset_set_iopt(struct cpuset *cp, c
 	} else if (streq(optionname, "memory_migrate")) {
 		cp->memory_migrate = !!value;
 		cp->memory_migrate_valid = 1;
+	} else if (streq(optionname, "mem_hardwall")) {
+		cp->mem_hardwall = !!value;
+		cp->mem_hardwall_valid = 1;
 	} else if (streq(optionname, "memory_spread_page")) {
 		cp->memory_spread_page = !!value;
 		cp->memory_spread_page_valid = 1;
 	} else if (streq(optionname, "memory_spread_slab")) {
 		cp->memory_spread_slab = !!value;
 		cp->memory_spread_slab_valid = 1;
+	} else if (streq(optionname, "sched_load_balance")) {
+		cp->sched_load_balance = !!value;
+		cp->sched_load_balance_valid = 1;
 	} else
 		return -2;	/* optionname not recognized */
 	return 0;
@@ -857,10 +867,14 @@ int cpuset_get_iopt(const struct cpuset
 		return cp->memory_pressure_enabled;
 	else if (streq(optionname, "memory_migrate"))
 		return cp->memory_migrate;
+	else if (streq(optionname, "mem_hardwall"))
+		return cp->mem_hardwall;
 	else if (streq(optionname, "memory_spread_page"))
 		return cp->memory_spread_page;
 	else if (streq(optionname, "memory_spread_slab"))
 		return cp->memory_spread_slab;
+	else if (streq(optionname, "sched_load_balance"))
+		return cp->sched_load_balance;
 	else
 		return -1;	/* optionname not recognized */
 }
@@ -1642,6 +1656,11 @@ static int apply_cpuset_settings(const c
 		if (store_flag(path, "memory_migrate", cp->memory_migrate) < 0)
 			goto err;
 	}
+	if (cp->mem_hardwall_valid &&
+	    exists_flag(path, "mem_hardwall")) {
+		if (store_flag(path, "mem_hardwall", cp->mem_hardwall) < 0)
+			goto err;
+	}
 	if (cp->memory_pressure_enabled_valid &&
 	    exists_flag(path, "memory_pressure_enabled")) {
 		if (store_flag(path, "memory_pressure_enabled", cp->memory_pressure_enabled) < 0)
@@ -1657,6 +1676,12 @@ static int apply_cpuset_settings(const c
 		if (store_flag(path, "memory_spread_slab", cp->memory_spread_slab) < 0)
 			goto err;
 	}
+	if (cp->sched_load_balance_valid &&
+	    exists_flag(path, "sched_load_balance")) {
+		if (store_flag(path, "sched_load_balance", cp->sched_load_balance) < 0)
+			goto err;
+	}
+
 	if (cp->cpus_valid && store_mask(path, "cpus", cp->cpus) < 0)
 		goto err;
 	if (cp->mems_valid && store_mask(path, "mems", cp->mems) < 0)
@@ -1912,6 +1937,12 @@ int cpuset_query(struct cpuset *cp, cons
 		cp->memory_migrate_valid = 1;
 	}
 
+	if (exists_flag(buf, "mem_hardwall")) {
+		if (load_flag(buf, &cp->mem_hardwall, "mem_hardwall") < 0)
+			goto err;
+		cp->mem_hardwall_valid = 1;
+	}
+
 	if (exists_flag(buf, "memory_pressure_enabled")) {
 		if (load_flag(buf, &cp->memory_pressure_enabled, "memory_pressure_enabled") < 0)
 			goto err;
@@ -1930,6 +1961,12 @@ int cpuset_query(struct cpuset *cp, cons
 		cp->memory_spread_slab_valid = 1;
 	}
 
+	if (exists_flag(buf, "sched_load_balance")) {
+		if (load_flag(buf, &cp->sched_load_balance, "sched_load_balance") < 0)
+			goto err;
+		cp->sched_load_balance_valid = 1;
+	}
+
 	if (load_mask(buf, &cp->cpus, cpuset_cpus_nbits(), "cpus") < 0)
 		goto err;
 	cp->cpus_valid = 1;
@@ -3291,6 +3328,10 @@ int cpuset_export(const struct cpuset *c
 		n += snprintf(buf + n, max(buflen - n, 0),
 							"memory_migrate\n");
 
+	if (cp->mem_hardwall)
+		n += snprintf(buf + n, max(buflen - n, 0),
+							"mem_hardwall\n");
+
 	if (cp->memory_spread_page)
 		n += snprintf(buf + n, max(buflen - n, 0),
 							"memory_spread_page\n");
@@ -3299,6 +3340,10 @@ int cpuset_export(const struct cpuset *c
 		n += snprintf(buf + n, max(buflen - n, 0),
 							"memory_spread_slab\n");
 
+	if (cp->sched_load_balance)
+		n += snprintf(buf + n, max(buflen - n, 0),
+							"sched_load_balance\n");
+
 	if ((tmp = sprint_mask_buf(cp->cpus)) == NULL)
 		return -1;
 	n += snprintf(buf + n, max(buflen - n, 0), "cpus %s\n", tmp);
@@ -3383,6 +3428,10 @@ int cpuset_import(struct cpuset *cp, con
 			cp->memory_migrate = 1;
 			goto eol;
 		}
+		if (streq(tok, "mem_hardwall")) {
+			cp->mem_hardwall = 1;
+			goto eol;
+		}
 		if (streq(tok, "memory_spread_page")) {
 			cp->memory_spread_page = 1;
 			goto eol;
@@ -3391,6 +3440,10 @@ int cpuset_import(struct cpuset *cp, con
 			cp->memory_spread_slab = 1;
 			goto eol;
 		}
+		if (streq(tok, "sched_load_balance")) {
+			cp->sched_load_balance = 1;
+			goto eol;
+		}
 		if (streq(tok, "cpu") || streq(tok, "cpus")) {
 			if (import_list(tok, arg, cp->cpus, emsg, elen) < 0)
 				goto err;
@@ -3434,9 +3487,11 @@ int cpuset_import(struct cpuset *cp, con
 	cp->mem_exclusive_valid = 1;
 	cp->notify_on_release_valid = 1;
 	cp->memory_migrate_valid = 1;
+	cp->mem_hardwall_valid = 1;
 	cp->memory_pressure_enabled_valid = 1;
 	cp->memory_spread_page_valid = 1;
 	cp->memory_spread_slab_valid = 1;
+	cp->sched_load_balance = 1;
 
 	return 0;
 err:
openSUSE Build Service is sponsored by