Hello community, here is the log from the commit of package libcpuset for openSUSE:Factory checked in at 2014-06-01 19:40:16 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/libcpuset (Old) and /work/SRC/openSUSE:Factory/.libcpuset.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "libcpuset" Changes: -------- --- /work/SRC/openSUSE:Factory/libcpuset/libcpuset.changes 2013-05-07 07:24:36.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.libcpuset.new/libcpuset.changes 2014-06-01 19:40:20.000000000 +0200 @@ -1,0 +2,14 @@ +Tue May 27 07:15:51 UTC 2014 - [email protected] + +- whack duplicate %patch1 -p1 in .spec + +------------------------------------------------------------------- +Tue May 27 07:09:12 UTC 2014 - [email protected] + +- Add missing fixes. + bug-514127_libcpuset-cpuset_set_iopt-adds.patch (SUSE bnc#514127) + initialize_buffer.patch (bnc unknown) + libcpuset-agnostic-mountpoint.diff (SUSE bnc#625079, SUSE bnc#834223) + libcpuset-handle-cgroup-mount.diff (SUSE bnc#625079, SUSE bnc#834223) + +------------------------------------------------------------------- New: ---- bug-514127_libcpuset-cpuset_set_iopt-adds.patch initialize_buffer.patch libcpuset-agnostic-mountpoint.diff libcpuset-handle-cgroup-mount.diff ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ libcpuset.spec ++++++ --- /var/tmp/diff_new_pack.9hwbWF/_old 2014-06-01 19:40:21.000000000 +0200 +++ /var/tmp/diff_new_pack.9hwbWF/_new 2014-06-01 19:40:21.000000000 +0200 @@ -1,7 +1,7 @@ # # spec file for package libcpuset # -# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -27,6 +27,10 @@ Source: libcpuset-%{version}.tar.bz2 Patch0: libcpuset-fix-missing-syscall.diff Patch1: libcpuset-rm-cpuonline.diff +Patch2: bug-514127_libcpuset-cpuset_set_iopt-adds.patch +Patch3: initialize_buffer.patch +Patch4: libcpuset-agnostic-mountpoint.diff +Patch5: libcpuset-handle-cgroup-mount.diff BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRequires: libbitmask-devel BuildRequires: libtool @@ -64,6 +68,10 @@ %setup -q -n %{name} %patch0 -p1 %patch1 -p1 +%patch2 -p1 +%patch3 -p1 +%patch4 -p1 +%patch5 -p1 %build sed -i -e 's@-Werror@@g' configure.in ++++++ bug-514127_libcpuset-cpuset_set_iopt-adds.patch ++++++ --- 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: ++++++ initialize_buffer.patch ++++++ --- libcpuset.c | 1 + 1 file changed, 1 insertion(+) --- a/libcpuset.c +++ b/libcpuset.c @@ -3250,6 +3250,7 @@ int cpuset_latestcpu(pid_t pid) else snprintf(buf, sizeof(buf), "/proc/%d/stat", pid); + memset(buf, '\0', sizeof(buf)); if ((fd = open(buf, O_RDONLY)) < 0) goto err; if (read(fd, buf, sizeof(buf)) < 1) ++++++ libcpuset-agnostic-mountpoint.diff ++++++ Subject: Make libcpuset mountpoint agnostic. Date: Wed Jun 19 09:23:00 CEST 2013 From: Mike Galbraith <[email protected]> References: bnc#625079, bnc#834223 Addendum: s/cpuset/,cpuset in scan to make sure we're seeing the mount option vs some dainbramaged path component. Signed-off-by: Mike Galbraith <[email protected]> --- libcpuset.c | 37 +++++++++++++++++++++++++++++-------- 1 file changed, 29 insertions(+), 8 deletions(-) --- a/libcpuset.c +++ b/libcpuset.c @@ -104,8 +104,8 @@ struct cpuset { unsigned sched_load_balance_valid:1; }; -/* Presumed cpuset file system mount point */ -static const char *cpusetmnt = "/dev/cpuset"; +/* Discovered cpuset file system mount point */ +static char cpusetmnt[PATH_MAX]; /* Stashed copy of cpunodemap[], mapping each cpu to its node. */ static const char *mapfile = "/var/run/cpunodemap"; @@ -194,11 +194,11 @@ static const char *sn_top_node_prefix = #endif /* - * Check that cpusets supported, /dev/cpuset mounted. + * Check that cpusets supported, cpuset controler is mounted. * If ok, return 0. * If not, return -1 and set errno: * ENOSYS - kernel doesn't support cpusets - * ENODEV - /dev/cpuset not mounted + * ENODEV - cpuset controller not mounted */ static enum { @@ -212,13 +212,34 @@ static int check() { if (check_state == check_notdone) { struct stat statbuf; + FILE *mounts; + char buf[PATH_MAX], *start, *end; + int found = 0; if (stat("/proc/self/cpuset", &statbuf) < 0) { check_state = check_enosys; goto done; } - if (stat("/dev/cpuset/tasks", &statbuf) < 0) { + mounts = fopen("/proc/mounts", "r"); + if (mounts == NULL) { + check_state = check_enosys; + goto done; + } + + while (fgets(buf, sizeof buf, mounts) != NULL) { + if (!strstr(buf, ",cpuset")) + continue; + start = strstr(buf, "/"); + end = strstr(start, " "); + *end = '\0'; + strcpy(cpusetmnt, start); + found = 1; + break; + } + fclose(mounts); + + if (!found) { check_state = check_enodev; goto done; } @@ -495,7 +516,7 @@ static char *pathcat3(char *buf, int buf * * Put full path of cpuset 'name' in buffer 'buf'. If name * starts with a slash (``/``) character, then this a path - * relative to ``/dev/cpuset``, otherwise it is relative to + * relative to cpusetmnt, otherwise it is relative to * the current tasks cpuset. Return 0 on success, else * -1 on error, setting errno. */ @@ -2232,7 +2253,7 @@ int cpuset_collides_exclusive(const char * EACCES - search permission denied on intervening directory * ETIME - timed out - tasks remain after 'seconds' timeout * EMFILE - too many open files - * ENODEV - /dev/cpuset not mounted + * ENODEV - cpuset controller not mounted * ENOENT - component of cpuset path doesn't exist * ENOMEM - out of memory * ENOSYS - kernel doesn't support cpusets @@ -2609,7 +2630,7 @@ int cpuset_move_all(struct cpuset_pidlis * EACCES - search permission denied on intervening directory * ENOTEMPTY - tasks remain after multiple attempts to move them * EMFILE - too many open files - * ENODEV - /dev/cpuset not mounted + * ENODEV - cpuset controller not mounted * ENOENT - component of cpuset path doesn't exist * ENOMEM - out of memory * ENOSYS - kernel doesn't support cpusets ++++++ libcpuset-handle-cgroup-mount.diff ++++++ Subject: libcpuset1, make it handle cpuset mounted as a cgroup controller >From Mike Galbraith <[email protected]> Date: Tue Sep 3 15:45:02 CEST 2013 References: bnc#625079, bnc#834223 Signed-off-by: Mike Galbraith <[email protected]> --- libcpuset.c | 166 ++++++++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 124 insertions(+), 42 deletions(-) --- a/libcpuset.c +++ b/libcpuset.c @@ -107,6 +107,69 @@ struct cpuset { /* Discovered cpuset file system mount point */ static char cpusetmnt[PATH_MAX]; +/* Is cpuset mounted as a cgroup controller? */ +static int cpusetmnt_is_cgroup; + +enum { + IDX_TASKS = 0, + IDX_CPUS, + IDX_CPU_EXCLUSIVE, + IDX_MEMS, + IDX_MEM_EXCLUSIVE, + IDX_MEM_HARDWALL, + IDX_MEMORY_MIGRATE, + IDX_MEMORY_PRESSURE, + IDX_MEMORY_PRESSURE_ENABLED, + IDX_MEMORY_SPREAD_PAGE, + IDX_MEMORY_SPREAD_SLAB, + IDX_SCHED_LOAD_BALANCE, + IDX_SCHED_RELAX_DOMAIN_LEVEL, + IDX_NOTIFY_ON_RELEASE, + IDX_RELEASE_AGENT, + IDX_NR_CPUSET_FILES, +}; + +static const char *cpuset_filenames[] = +{ + [IDX_TASKS] = "tasks", + [IDX_CPUS] = "cpus", + [IDX_CPU_EXCLUSIVE] = "cpu_exclusive", + [IDX_MEMS] = "mems", + [IDX_MEM_EXCLUSIVE] = "mem_exclusive", + [IDX_MEM_HARDWALL] = "mem_hardwall", + [IDX_MEMORY_MIGRATE] = "memory_migrate", + [IDX_MEMORY_PRESSURE] = "memory_pressure", + [IDX_MEMORY_PRESSURE_ENABLED] = "memory_pressure_enabled", + [IDX_MEMORY_SPREAD_PAGE] = "memory_spread_page", + [IDX_MEMORY_SPREAD_SLAB] = "memory_spread_slab", + [IDX_SCHED_LOAD_BALANCE] = "sched_load_balance", + [IDX_SCHED_RELAX_DOMAIN_LEVEL] = "sched_relax_domain_level", + [IDX_NOTIFY_ON_RELEASE] = "notify_on_release", + [IDX_RELEASE_AGENT] = "release_agent", +}; + +static const char *cgroup_filenames[] = +{ + [IDX_TASKS] = "tasks", + [IDX_CPUS] = "cpuset.cpus", + [IDX_CPU_EXCLUSIVE] = "cpuset.cpu_exclusive", + [IDX_MEMS] = "cpuset.mems", + [IDX_MEM_EXCLUSIVE] = "cpuset.mem_exclusive", + [IDX_MEM_HARDWALL] = "cpuset.mem_hardwall", + [IDX_MEMORY_MIGRATE] = "cpuset.memory_migrate", + [IDX_MEMORY_PRESSURE] = "cpuset.memory_pressure", + [IDX_MEMORY_PRESSURE_ENABLED] = "cpuset.memory_pressure_enabled", + [IDX_MEMORY_SPREAD_PAGE] = "cpuset.memory_spread_page", + [IDX_MEMORY_SPREAD_SLAB] = "cpuset.memory_spread_slab", + [IDX_SCHED_LOAD_BALANCE] = "cpuset.sched_load_balance", + [IDX_SCHED_RELAX_DOMAIN_LEVEL] = "cpuset.sched_relax_domain_level", + [IDX_NOTIFY_ON_RELEASE] = "notify_on_release", + [IDX_RELEASE_AGENT] = "release_agent", +}; + +/* Pointer to cpuset/cgroup_filenames, depending on detected mount type */ +static const char **filenames = &cpuset_filenames[0]; + /* Stashed copy of cpunodemap[], mapping each cpu to its node. */ static const char *mapfile = "/var/run/cpunodemap"; @@ -234,6 +297,25 @@ static int check() end = strstr(start, " "); *end = '\0'; strcpy(cpusetmnt, start); + /* + * Now check for a -t cgroup vs -t cpuset mount, + * a cgroup mount prefixes files with "cpuset.". + * If neither is found, something is whacky, skip + * this mountpoint. + */ + strcpy(buf, cpusetmnt); + strcat(buf, "/cpuset.cpus"); + if (stat(buf, &statbuf) == 0) { + cpusetmnt_is_cgroup = 1; + filenames = cgroup_filenames; + } else { + strcpy(buf, cpusetmnt); + strcat(buf, "/cpus"); + if (stat(buf, &statbuf) != 0) { + *cpusetmnt = '\0'; + continue; + } + } found = 1; break; } @@ -1664,48 +1746,48 @@ int cpuset_cpu2node(int cpu) static int apply_cpuset_settings(const char *path, const struct cpuset *cp) { if (cp->cpu_exclusive_valid && - store_flag(path, "cpu_exclusive", cp->cpu_exclusive) < 0) + store_flag(path, filenames[IDX_CPU_EXCLUSIVE], cp->cpu_exclusive) < 0) goto err; if (cp->mem_exclusive_valid && - store_flag(path, "mem_exclusive", cp->mem_exclusive) < 0) + store_flag(path, filenames[IDX_MEM_EXCLUSIVE], cp->mem_exclusive) < 0) goto err; if (cp->notify_on_release_valid && - store_flag(path, "notify_on_release", cp->notify_on_release) < 0) + store_flag(path, filenames[IDX_NOTIFY_ON_RELEASE], cp->notify_on_release) < 0) goto err; if (cp->memory_migrate_valid && - exists_flag(path, "memory_migrate")) { - if (store_flag(path, "memory_migrate", cp->memory_migrate) < 0) + exists_flag(path, filenames[IDX_MEMORY_MIGRATE])) { + if (store_flag(path, filenames[IDX_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) + exists_flag(path, filenames[IDX_MEM_HARDWALL])) { + if (store_flag(path, filenames[IDX_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) + exists_flag(path, filenames[IDX_MEMORY_PRESSURE_ENABLED])) { + if (store_flag(path, filenames[IDX_MEMORY_PRESSURE_ENABLED], cp->memory_pressure_enabled) < 0) goto err; } if (cp->memory_spread_page_valid && - exists_flag(path, "memory_spread_page")) { - if (store_flag(path, "memory_spread_page", cp->memory_spread_page) < 0) + exists_flag(path, filenames[IDX_MEMORY_SPREAD_PAGE])) { + if (store_flag(path, filenames[IDX_MEMORY_SPREAD_PAGE], cp->memory_spread_page) < 0) goto err; } if (cp->memory_spread_slab_valid && - exists_flag(path, "memory_spread_slab")) { - if (store_flag(path, "memory_spread_slab", cp->memory_spread_slab) < 0) + exists_flag(path, filenames[IDX_MEMORY_SPREAD_SLAB])) { + if (store_flag(path, filenames[IDX_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) + exists_flag(path, filenames[IDX_SCHED_LOAD_BALANCE])) { + if (store_flag(path, filenames[IDX_SCHED_LOAD_BALANCE], cp->sched_load_balance) < 0) goto err; } - if (cp->cpus_valid && store_mask(path, "cpus", cp->cpus) < 0) + if (cp->cpus_valid && store_mask(path, filenames[IDX_CPUS], cp->cpus) < 0) goto err; - if (cp->mems_valid && store_mask(path, "mems", cp->mems) < 0) + if (cp->mems_valid && store_mask(path, filenames[IDX_MEMS], cp->mems) < 0) goto err; return 0; err: @@ -1940,59 +2022,59 @@ int cpuset_query(struct cpuset *cp, cons fullpath(buf, sizeof(buf), relpath); - if (load_flag(buf, &cp->cpu_exclusive, "cpu_exclusive") < 0) + if (load_flag(buf, &cp->cpu_exclusive, filenames[IDX_CPU_EXCLUSIVE]) < 0) goto err; cp->cpu_exclusive_valid = 1; - if (load_flag(buf, &cp->mem_exclusive, "mem_exclusive") < 0) + if (load_flag(buf, &cp->mem_exclusive, filenames[IDX_MEM_EXCLUSIVE]) < 0) goto err; cp->mem_exclusive_valid = 1; - if (load_flag(buf, &cp->notify_on_release, "notify_on_release") < 0) + if (load_flag(buf, &cp->notify_on_release, filenames[IDX_NOTIFY_ON_RELEASE]) < 0) goto err; cp->notify_on_release_valid = 1; - if (exists_flag(buf, "memory_migrate")) { - if (load_flag(buf, &cp->memory_migrate, "memory_migrate") < 0) + if (exists_flag(buf, filenames[IDX_MEMORY_MIGRATE])) { + if (load_flag(buf, &cp->memory_migrate, filenames[IDX_MEMORY_MIGRATE]) < 0) goto err; cp->memory_migrate_valid = 1; } - if (exists_flag(buf, "mem_hardwall")) { - if (load_flag(buf, &cp->mem_hardwall, "mem_hardwall") < 0) + if (exists_flag(buf, filenames[IDX_MEM_HARDWALL])) { + if (load_flag(buf, &cp->mem_hardwall, filenames[IDX_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) + if (exists_flag(buf, filenames[IDX_MEMORY_PRESSURE_ENABLED])) { + if (load_flag(buf, &cp->memory_pressure_enabled, filenames[IDX_MEMORY_PRESSURE_ENABLED]) < 0) goto err; cp->memory_pressure_enabled_valid = 1; } - if (exists_flag(buf, "memory_spread_page")) { - if (load_flag(buf, &cp->memory_spread_page, "memory_spread_page") < 0) + if (exists_flag(buf, filenames[IDX_MEMORY_SPREAD_PAGE])) { + if (load_flag(buf, &cp->memory_spread_page, filenames[IDX_MEMORY_SPREAD_PAGE]) < 0) goto err; cp->memory_spread_page_valid = 1; } - if (exists_flag(buf, "memory_spread_slab")) { - if (load_flag(buf, &cp->memory_spread_slab, "memory_spread_slab") < 0) + if (exists_flag(buf, filenames[IDX_MEMORY_SPREAD_SLAB])) { + if (load_flag(buf, &cp->memory_spread_slab, filenames[IDX_MEMORY_SPREAD_SLAB]) < 0) goto err; 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) + if (exists_flag(buf, filenames[IDX_SCHED_LOAD_BALANCE])) { + if (load_flag(buf, &cp->sched_load_balance, filenames[IDX_SCHED_LOAD_BALANCE]) < 0) goto err; cp->sched_load_balance_valid = 1; } - if (load_mask(buf, &cp->cpus, cpuset_cpus_nbits(), "cpus") < 0) + if (load_mask(buf, &cp->cpus, cpuset_cpus_nbits(), filenames[IDX_CPUS]) < 0) goto err; cp->cpus_valid = 1; - if (load_mask(buf, &cp->mems, cpuset_mems_nbits(), "mems") < 0) + if (load_mask(buf, &cp->mems, cpuset_mems_nbits(), filenames[IDX_MEMS]) < 0) goto err; cp->mems_valid = 1; @@ -2724,16 +2806,16 @@ int cpuset_migrate(pid_t pid, const char fullpath(buf2, sizeof(buf2), relpath); - if (load_flag(buf2, &memory_migrate_flag, "memory_migrate") < 0) + if (load_flag(buf2, &memory_migrate_flag, filenames[IDX_MEMORY_MIGRATE]) < 0) return -1; - if (store_flag(buf2, "memory_migrate", 1) < 0) + if (store_flag(buf2, filenames[IDX_MEMORY_MIGRATE], 1) < 0) return -1; - fullpath2(buf, sizeof(buf), relpath, "tasks"); + fullpath2(buf, sizeof(buf), relpath, filenames[IDX_TASKS]); r = __cpuset_move(pid, buf); - store_flag(buf2, "memory_migrate", memory_migrate_flag); + store_flag(buf2, filenames[IDX_MEMORY_MIGRATE], memory_migrate_flag); return r; } @@ -2751,19 +2833,19 @@ int cpuset_migrate_all(struct cpuset_pid fullpath(buf2, sizeof(buf2), relpath); - if (load_flag(buf2, &memory_migrate_flag, "memory_migrate") < 0) + if (load_flag(buf2, &memory_migrate_flag, filenames[IDX_MEMORY_MIGRATE]) < 0) return -1; - if (store_flag(buf2, "memory_migrate", 1) < 0) + if (store_flag(buf2, filenames[IDX_MEMORY_MIGRATE], 1) < 0) return -1; - fullpath2(buf, sizeof(buf), relpath, "tasks"); + fullpath2(buf, sizeof(buf), relpath, filenames[IDX_TASKS]); ret = 0; for (i = 0; i < pl->npids; i++) if (__cpuset_move(pl->pids[i], buf) < 0) ret = -1; - if (store_flag(buf2, "memory_migrate", memory_migrate_flag) < 0) + if (store_flag(buf2, filenames[IDX_MEMORY_MIGRATE], memory_migrate_flag) < 0) ret = -1; return ret; } -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
