Hello community, here is the log from the commit of package numactl for openSUSE:Factory checked in at 2020-10-08 13:08:08 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/numactl (Old) and /work/SRC/openSUSE:Factory/.numactl.new.4249 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "numactl" Thu Oct 8 13:08:08 2020 rev:62 rq:839315 version:2.0.14 Changes: -------- --- /work/SRC/openSUSE:Factory/numactl/numactl.changes 2020-01-19 20:50:58.731846691 +0100 +++ /work/SRC/openSUSE:Factory/.numactl.new.4249/numactl.changes 2020-10-08 13:09:30.763027314 +0200 @@ -1,0 +2,9 @@ +Sat Oct 3 12:11:20 UTC 2020 - Dirk Mueller <dmuel...@suse.com> + +- update to 2.0.14: + * manpage update + * numademo: fix issue on 32 bit systems + * drop custom cflags for libnuma + * use symvers attribute for symbol versioning + +------------------------------------------------------------------- Old: ---- numactl-2.0.13.tar.gz New: ---- numactl-2.0.14.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ numactl.spec ++++++ --- /var/tmp/diff_new_pack.NP61zm/_old 2020-10-08 13:09:31.699028162 +0200 +++ /var/tmp/diff_new_pack.NP61zm/_new 2020-10-08 13:09:31.703028165 +0200 @@ -17,7 +17,7 @@ Name: numactl -Version: 2.0.13 +Version: 2.0.14 Release: 0 Summary: NUMA Policy Control License: GPL-2.0-only ++++++ numactl-2.0.13.tar.gz -> numactl-2.0.14.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numactl-2.0.13/Makefile.am new/numactl-2.0.14/Makefile.am --- old/numactl-2.0.13/Makefile.am 2019-08-20 23:14:29.000000000 +0200 +++ new/numactl-2.0.14/Makefile.am 2020-09-18 02:40:08.000000000 +0200 @@ -24,7 +24,7 @@ numademo_SOURCES = numademo.c stream_lib.c stream_lib.h mt.c mt.h clearcache.c clearcache.h numademo_CPPFLAGS = $(AM_CPPFLAGS) -DHAVE_STREAM_LIB -DHAVE_MT -DHAVE_CLEAR_CACHE -numademo_CFLAGS = -O3 -ffast-math -funroll-loops +numademo_CFLAGS = $(AM_CFLAGS) -O3 -ffast-math -funroll-loops if HAVE_TREE_VECTORIZE numademo_CFLAGS += -ftree-vectorize endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numactl-2.0.13/Makefile.in new/numactl-2.0.14/Makefile.in --- old/numactl-2.0.13/Makefile.in 2019-08-30 10:11:42.000000000 +0200 +++ new/numactl-2.0.14/Makefile.in 2020-09-18 02:56:43.000000000 +0200 @@ -681,7 +681,8 @@ numastat_CFLAGS = $(AM_CFLAGS) -std=gnu99 numademo_SOURCES = numademo.c stream_lib.c stream_lib.h mt.c mt.h clearcache.c clearcache.h numademo_CPPFLAGS = $(AM_CPPFLAGS) -DHAVE_STREAM_LIB -DHAVE_MT -DHAVE_CLEAR_CACHE -numademo_CFLAGS = -O3 -ffast-math -funroll-loops $(am__append_1) +numademo_CFLAGS = $(AM_CFLAGS) -O3 -ffast-math -funroll-loops \ + $(am__append_1) numademo_LDADD = libnuma.la -lm migratepages_SOURCES = migratepages.c util.c migratepages_LDADD = libnuma.la diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numactl-2.0.13/config.h.in new/numactl-2.0.14/config.h.in --- old/numactl-2.0.13/config.h.in 2019-08-30 10:11:42.000000000 +0200 +++ new/numactl-2.0.14/config.h.in 2020-09-18 02:56:44.000000000 +0200 @@ -1,5 +1,8 @@ /* config.h.in. Generated from configure.ac by autoheader. */ +/* Checking for symver attribute */ +#undef HAVE_ATTRIBUTE_SYMVER + /* Define to 1 if you have the <dlfcn.h> header file. */ #undef HAVE_DLFCN_H diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numactl-2.0.13/configure new/numactl-2.0.14/configure --- old/numactl-2.0.13/configure 2019-08-30 10:11:42.000000000 +0200 +++ new/numactl-2.0.14/configure 2020-09-18 02:56:42.000000000 +0200 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for numactl 2.0.13. +# Generated by GNU Autoconf 2.69 for numactl 2.0.14. # # # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. @@ -587,8 +587,8 @@ # Identity of this package. PACKAGE_NAME='numactl' PACKAGE_TARNAME='numactl' -PACKAGE_VERSION='2.0.13' -PACKAGE_STRING='numactl 2.0.13' +PACKAGE_VERSION='2.0.14' +PACKAGE_STRING='numactl 2.0.14' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -629,6 +629,7 @@ # include <unistd.h> #endif" +ac_c_werror_flag= ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS @@ -1313,7 +1314,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures numactl 2.0.13 to adapt to many kinds of systems. +\`configure' configures numactl 2.0.14 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1383,7 +1384,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of numactl 2.0.13:";; + short | recursive ) echo "Configuration of numactl 2.0.14:";; esac cat <<\_ACEOF @@ -1493,7 +1494,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -numactl configure 2.0.13 +numactl configure 2.0.14 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -1771,7 +1772,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by numactl $as_me 2.0.13, which was +It was created by numactl $as_me 2.0.14, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2640,7 +2641,7 @@ # Define the identity of the package. PACKAGE='numactl' - VERSION='2.0.13' + VERSION='2.0.14' cat >>confdefs.h <<_ACEOF @@ -12735,6 +12736,28 @@ ac_config_files="$ac_config_files Makefile" +# GCC tries to be "helpful" and only issue a warning for unrecognized +# attributes. So we compile the test with Werror, so that if the +# attribute is not recognized the compilation fails +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +ac_c_werror_flag=yes +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +__attribute__ ((symver ("foo@foo_1"))) void frob (void) { } +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + +$as_echo "#define HAVE_ATTRIBUTE_SYMVER 1" >>confdefs.h + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure @@ -13273,7 +13296,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by numactl $as_me 2.0.13, which was +This file was extended by numactl $as_me 2.0.14, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -13339,7 +13362,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -numactl config.status 2.0.13 +numactl config.status 2.0.14 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numactl-2.0.13/configure.ac new/numactl-2.0.14/configure.ac --- old/numactl-2.0.13/configure.ac 2019-08-30 01:27:11.000000000 +0200 +++ new/numactl-2.0.14/configure.ac 2020-09-18 02:54:15.000000000 +0200 @@ -1,5 +1,5 @@ AC_PREREQ([2.64]) -AC_INIT([numactl], [2.0.13]) +AC_INIT([numactl], [2.0.14]) AC_CONFIG_SRCDIR([numactl.c]) AC_CONFIG_MACRO_DIR([m4]) @@ -24,4 +24,12 @@ AC_CONFIG_FILES([Makefile]) +# GCC tries to be "helpful" and only issue a warning for unrecognized +# attributes. So we compile the test with Werror, so that if the +# attribute is not recognized the compilation fails +AC_LANG(C) +AC_LANG_WERROR +AC_COMPILE_IFELSE([AC_LANG_SOURCE([[__attribute__ ((symver ("foo@foo_1"))) void frob (void) { }]])], + [AC_DEFINE([HAVE_ATTRIBUTE_SYMVER], [1], [Checking for symver attribute])], []) + AC_OUTPUT diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numactl-2.0.13/libnuma.c new/numactl-2.0.14/libnuma.c --- old/numactl-2.0.13/libnuma.c 2019-08-30 01:27:06.000000000 +0200 +++ new/numactl-2.0.14/libnuma.c 2020-09-18 02:26:29.000000000 +0200 @@ -58,7 +58,9 @@ struct bitmask *numa_nodes_ptr = NULL; static struct bitmask *numa_memnode_ptr = NULL; static unsigned long *node_cpu_mask_v1[NUMA_NUM_NODES]; +static char node_cpu_mask_v1_stale = 1; static struct bitmask **node_cpu_mask_v2; +static char node_cpu_mask_v2_stale = 1; WEAK void numa_error(char *where); @@ -686,19 +688,19 @@ * which for v1 is the size of a numa.h nodemask_t(in bits)-1. * but for v2 is the size of a kernel nodemask_t(in bits)-1. */ +SYMVER("numa_max_possible_node_v1", "numa_max_possible_node@libnuma_1.1") int numa_max_possible_node_v1(void) { return ((sizeof(nodemask_t)*8)-1); } -__asm__(".symver numa_max_possible_node_v1,numa_max_possible_node@libnuma_1.1"); +SYMVER("numa_max_possible_node_v2", "numa_max_possible_node@@libnuma_1.2") int numa_max_possible_node_v2(void) { return numa_num_possible_nodes()-1; } -__asm__(".symver numa_max_possible_node_v2,numa_max_possible_node@@libnuma_1.2"); make_internal_alias(numa_max_possible_node_v1); make_internal_alias(numa_max_possible_node_v2); @@ -791,10 +793,10 @@ make_internal_alias(numa_node_size64); -long numa_node_size(int node, long *freep) +long long numa_node_size(int node, long long *freep) { long long f2; - long sz = numa_node_size64_int(node, &f2); + long long sz = numa_node_size64_int(node, &f2); if (freep) *freep = f2; return sz; @@ -807,6 +809,7 @@ return 0; } +SYMVER("numa_interleave_memory_v1", "numa_interleave_memory@libnuma_1.1") void numa_interleave_memory_v1(void *mem, size_t size, const nodemask_t *mask) { @@ -816,14 +819,13 @@ bitmask.maskp = (unsigned long *)mask; dombind(mem, size, MPOL_INTERLEAVE, &bitmask); } -__asm__(".symver numa_interleave_memory_v1,numa_interleave_memory@libnuma_1.1"); +SYMVER("numa_interleave_memory_v2", "numa_interleave_memory@@libnuma_1.2") void numa_interleave_memory_v2(void *mem, size_t size, struct bitmask *bmp) { dombind(mem, size, MPOL_INTERLEAVE, bmp); } -__asm__(".symver numa_interleave_memory_v2,numa_interleave_memory@@libnuma_1.2"); void numa_tonode_memory(void *mem, size_t size, int node) { @@ -835,6 +837,7 @@ numa_bitmask_free(nodes); } +SYMVER("numa_tonodemask_memory_v1", "numa_tonodemask_memory@libnuma_1.1") void numa_tonodemask_memory_v1(void *mem, size_t size, const nodemask_t *mask) { @@ -844,14 +847,13 @@ bitmask.size = sizeof(nodemask_t); dombind(mem, size, bind_policy, &bitmask); } -__asm__(".symver numa_tonodemask_memory_v1,numa_tonodemask_memory@libnuma_1.1"); +SYMVER("numa_tonodemask_memory_v2", "numa_tonodemask_memory@@libnuma_1.2") void numa_tonodemask_memory_v2(void *mem, size_t size, struct bitmask *bmp) { dombind(mem, size, bind_policy, bmp); } -__asm__(".symver numa_tonodemask_memory_v2,numa_tonodemask_memory@@libnuma_1.2"); void numa_setlocal_memory(void *mem, size_t size) { @@ -896,6 +898,7 @@ return mem; } +SYMVER("numa_alloc_interleaved_subset_v1", "numa_alloc_interleaved_subset@libnuma_1.1") void *numa_alloc_interleaved_subset_v1(size_t size, const nodemask_t *mask) { char *mem; @@ -910,8 +913,8 @@ dombind(mem, size, MPOL_INTERLEAVE, &bitmask); return mem; } -__asm__(".symver numa_alloc_interleaved_subset_v1,numa_alloc_interleaved_subset@libnuma_1.1"); +SYMVER("numa_alloc_interleaved_subset_v2", "numa_alloc_interleaved_subset@@libnuma_1.2") void *numa_alloc_interleaved_subset_v2(size_t size, struct bitmask *bmp) { char *mem; @@ -923,7 +926,6 @@ dombind(mem, size, MPOL_INTERLEAVE, bmp); return mem; } -__asm__(".symver numa_alloc_interleaved_subset_v2,numa_alloc_interleaved_subset@@libnuma_1.2"); make_internal_alias(numa_alloc_interleaved_subset_v1); make_internal_alias(numa_alloc_interleaved_subset_v2); @@ -937,6 +939,7 @@ /* * given a user node mask, set memory policy to use those nodes */ +SYMVER("numa_set_interleave_mask_v1", "numa_set_interleave_mask@libnuma_1.1") void numa_set_interleave_mask_v1(nodemask_t *mask) { @@ -952,8 +955,8 @@ numa_bitmask_free(bmp); } -__asm__(".symver numa_set_interleave_mask_v1,numa_set_interleave_mask@libnuma_1.1"); +SYMVER("numa_set_interleave_mask_v2", "numa_set_interleave_mask@@libnuma_1.2") void numa_set_interleave_mask_v2(struct bitmask *bmp) { @@ -962,8 +965,8 @@ else setpol(MPOL_INTERLEAVE, bmp); } -__asm__(".symver numa_set_interleave_mask_v2,numa_set_interleave_mask@@libnuma_1.2"); +SYMVER("numa_get_interleave_mask_v1", "numa_get_interleave_mask@libnuma_1.1") nodemask_t numa_get_interleave_mask_v1(void) { @@ -980,8 +983,8 @@ numa_bitmask_free(bmp); return mask; } -__asm__(".symver numa_get_interleave_mask_v1,numa_get_interleave_mask@libnuma_1.1"); +SYMVER("numa_get_interleave_mask_v2", "numa_get_interleave_mask@@libnuma_1.2") struct bitmask * numa_get_interleave_mask_v2(void) { @@ -994,7 +997,6 @@ copy_bitmask_to_bitmask(numa_no_nodes_ptr, bmp); return bmp; } -__asm__(".symver numa_get_interleave_mask_v2,numa_get_interleave_mask@@libnuma_1.2"); /* (undocumented) */ int numa_get_interleave_node(void) @@ -1042,6 +1044,7 @@ bind_policy = MPOL_PREFERRED; } +SYMVER("numa_set_membind_v1", "numa_set_membind@libnuma_1.1") void numa_set_membind_v1(const nodemask_t *mask) { @@ -1051,14 +1054,13 @@ bitmask.size = sizeof(nodemask_t); setpol(MPOL_BIND, &bitmask); } -__asm__(".symver numa_set_membind_v1,numa_set_membind@libnuma_1.1"); +SYMVER("numa_set_membind_v2", "numa_set_membind@@libnuma_1.2") void numa_set_membind_v2(struct bitmask *bmp) { setpol(MPOL_BIND, bmp); } -__asm__(".symver numa_set_membind_v2,numa_set_membind@@libnuma_1.2"); make_internal_alias(numa_set_membind_v2); @@ -1117,6 +1119,7 @@ } } +SYMVER("numa_get_membind_v1", "numa_get_membind@libnuma_1.1") nodemask_t numa_get_membind_v1(void) { @@ -1136,8 +1139,8 @@ numa_bitmask_free(bmp); return nmp; } -__asm__(".symver numa_get_membind_v1,numa_get_membind@libnuma_1.1"); +SYMVER("numa_get_membind_v2", "numa_get_membind@@libnuma_1.2") struct bitmask * numa_get_membind_v2(void) { @@ -1150,7 +1153,6 @@ copy_bitmask_to_bitmask(numa_all_nodes_ptr, bmp); return bmp; } -__asm__(".symver numa_get_membind_v2,numa_get_membind@@libnuma_1.2"); //TODO: do we need a v1 nodemask_t version? struct bitmask *numa_get_mems_allowed(void) @@ -1173,6 +1175,7 @@ munmap(mem, size); } +SYMVER("numa_parse_bitmap_v1", "numa_parse_bitmap@libnuma_1.1") int numa_parse_bitmap_v1(char *line, unsigned long *mask, int ncpus) { @@ -1206,8 +1209,8 @@ } return 0; } -__asm__(".symver numa_parse_bitmap_v1,numa_parse_bitmap@libnuma_1.1"); +SYMVER("numa_parse_bitmap_v2", "numa_parse_bitmap@@libnuma_1.2") int numa_parse_bitmap_v2(char *line, struct bitmask *mask) { @@ -1242,7 +1245,6 @@ } return 0; } -__asm__(".symver numa_parse_bitmap_v2,numa_parse_bitmap@@libnuma_1.2"); static void init_node_cpu_mask_v2(void) { @@ -1266,12 +1268,14 @@ /* This would be better with some locking, but I don't want to make libnuma dependent on pthreads right now. The races are relatively harmless. */ +SYMVER("numa_node_to_cpus_v1", "numa_node_to_cpus@libnuma_1.1") int numa_node_to_cpus_v1(int node, unsigned long *buffer, int bufferlen) { int err = 0; char fn[64]; FILE *f; + char update; char *line = NULL; size_t len = 0; struct bitmask bitmask; @@ -1287,7 +1291,8 @@ } if (bufferlen > buflen_needed) memset(buffer, 0, bufferlen); - if (node_cpu_mask_v1[node]) { + update = __atomic_fetch_and(&node_cpu_mask_v1_stale, 0, __ATOMIC_RELAXED); + if (node_cpu_mask_v1[node] && !update) { memcpy(buffer, node_cpu_mask_v1[node], buflen_needed); return 0; } @@ -1328,14 +1333,21 @@ /* slightly racy, see above */ if (node_cpu_mask_v1[node]) { - if (mask != buffer) + if (update) { + /* + * There may be readers on node_cpu_mask_v1[], hence it can not + * be freed. + */ + memcpy(node_cpu_mask_v1[node], mask, buflen_needed); + free(mask); + mask = NULL; + } else if (mask != buffer) free(mask); } else { node_cpu_mask_v1[node] = mask; } return err; } -__asm__(".symver numa_node_to_cpus_v1,numa_node_to_cpus@libnuma_1.1"); /* * test whether a node has cpus @@ -1345,6 +1357,7 @@ /* * deliver a bitmask of cpus representing the cpus on a given node */ +SYMVER("numa_node_to_cpus_v2", "numa_node_to_cpus@@libnuma_1.2") int numa_node_to_cpus_v2(int node, struct bitmask *buffer) { @@ -1352,6 +1365,7 @@ int nnodes = numa_max_node(); char fn[64], *line = NULL; FILE *f; + char update; size_t len = 0; struct bitmask *mask; @@ -1364,7 +1378,8 @@ } numa_bitmask_clearall(buffer); - if (node_cpu_mask_v2[node]) { + update = __atomic_fetch_and(&node_cpu_mask_v2_stale, 0, __ATOMIC_RELAXED); + if (node_cpu_mask_v2[node] && !update) { /* have already constructed a mask for this node */ if (buffer->size < node_cpu_mask_v2[node]->size) { errno = EINVAL; @@ -1407,8 +1422,12 @@ /* slightly racy, see above */ /* save the mask we created */ if (node_cpu_mask_v2[node]) { + if (update) { + copy_bitmask_to_bitmask(mask, node_cpu_mask_v2[node]); + numa_bitmask_free(mask); + mask = NULL; /* how could this be? */ - if (mask != buffer) + } else if (mask != buffer) numa_bitmask_free(mask); } else { /* we don't want to cache faulty result */ @@ -1419,11 +1438,16 @@ } return err; } -__asm__(".symver numa_node_to_cpus_v2,numa_node_to_cpus@@libnuma_1.2"); make_internal_alias(numa_node_to_cpus_v1); make_internal_alias(numa_node_to_cpus_v2); +void numa_node_to_cpu_update(void) +{ + __atomic_store_n(&node_cpu_mask_v1_stale, 1, __ATOMIC_RELAXED); + __atomic_store_n(&node_cpu_mask_v2_stale, 1, __ATOMIC_RELAXED); +} + /* report the node of the specified cpu */ int numa_node_of_cpu(int cpu) { @@ -1454,6 +1478,7 @@ return ret; } +SYMVER("numa_run_on_node_mask_v1", "numa_run_on_node_mask@libnuma_1.1") int numa_run_on_node_mask_v1(const nodemask_t *mask) { @@ -1506,13 +1531,13 @@ } return err; } -__asm__(".symver numa_run_on_node_mask_v1,numa_run_on_node_mask@libnuma_1.1"); /* * Given a node mask (size of a kernel nodemask_t) (probably populated by * a user argument list) set up a map of cpus (map "cpus") on those nodes. * Then set affinity to those cpus. */ +SYMVER("numa_run_on_node_mask_v2", "numa_run_on_node_mask@@libnuma_1.2") int numa_run_on_node_mask_v2(struct bitmask *bmp) { @@ -1557,7 +1582,6 @@ return err; } -__asm__(".symver numa_run_on_node_mask_v2,numa_run_on_node_mask@@libnuma_1.2"); make_internal_alias(numa_run_on_node_mask_v2); @@ -1607,6 +1631,7 @@ return err; } +SYMVER("numa_get_run_node_mask_v1", "numa_get_run_node_mask@libnuma_1.1") nodemask_t numa_get_run_node_mask_v1(void) { @@ -1641,8 +1666,8 @@ numa_bitmask_free(cpus); return nmp; } -__asm__(".symver numa_get_run_node_mask_v1,numa_get_run_node_mask@libnuma_1.1"); +SYMVER("numa_get_run_node_mask_v2", "numa_get_run_node_mask@@libnuma_1.2") struct bitmask * numa_get_run_node_mask_v2(void) { @@ -1681,7 +1706,6 @@ numa_bitmask_free(cpus); return bmp; } -__asm__(".symver numa_get_run_node_mask_v2,numa_get_run_node_mask@@libnuma_1.2"); int numa_migrate_pages(int pid, struct bitmask *fromnodes, struct bitmask *tonodes) @@ -1768,6 +1792,7 @@ setpol(MPOL_DEFAULT, numa_no_nodes_ptr); } +SYMVER("numa_bind_v1", "numa_bind@libnuma_1.1") void numa_bind_v1(const nodemask_t *nodemask) { struct bitmask bitmask; @@ -1777,14 +1802,13 @@ numa_run_on_node_mask_v2_int(&bitmask); numa_set_membind_v2_int(&bitmask); } -__asm__(".symver numa_bind_v1,numa_bind@libnuma_1.1"); +SYMVER("numa_bind_v2", "numa_bind@@libnuma_1.2") void numa_bind_v2(struct bitmask *bmp) { numa_run_on_node_mask_v2_int(bmp); numa_set_membind_v2_int(bmp); } -__asm__(".symver numa_bind_v2,numa_bind@@libnuma_1.2"); void numa_set_strict(int flag) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numactl-2.0.13/numa.3 new/numactl-2.0.14/numa.3 --- old/numactl-2.0.13/numa.3 2019-08-20 19:36:49.000000000 +0200 +++ new/numactl-2.0.14/numa.3 2020-09-18 02:08:51.000000000 +0200 @@ -124,6 +124,8 @@ .br .BI "int numa_node_to_cpus(int " node ", struct bitmask *" mask "); .br +.BI "void numa_node_to_cpu_update();" +.br .BI "int numa_node_of_cpu(int " cpu "); .sp .BI "struct bitmask *numa_allocate_cpumask();" @@ -232,6 +234,7 @@ their memory. The exceptions to this are: .IR numa_node_to_cpus (), +.IR numa_node_to_cpu_update (), .IR numa_node_of_cpu (), .IR numa_bind (), .IR numa_run_on_node (), @@ -795,6 +798,12 @@ .I ERANGE and \-1 returned. On success 0 is returned. +.BR numa_node_to_cpu_update () +Mark cpus bitmask of all nodes stale, then get the latest bitmask by calling +.BR numa_node_to_cpus () +This allows to update the libnuma state after a CPU hotplug event. The application +is in charge of detecting CPU hotplug events. + .BR numa_node_of_cpu () returns the node that a cpu belongs to. If the user supplies an invalid cpu .I errno diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numactl-2.0.13/numa.h new/numactl-2.0.14/numa.h --- old/numactl-2.0.13/numa.h 2019-08-30 01:27:06.000000000 +0200 +++ new/numactl-2.0.14/numa.h 2020-09-18 02:08:51.000000000 +0200 @@ -143,7 +143,7 @@ /* Return node size and free memory */ long long numa_node_size64(int node, long long *freep); -long numa_node_size(int node, long *freep); +long long numa_node_size(int node, long long *freep); int numa_pagesize(void); @@ -282,6 +282,8 @@ /* Convert node to CPU mask. -1/errno on failure, otherwise 0. */ int numa_node_to_cpus(int, struct bitmask *); +void numa_node_to_cpu_update(void); + /* report the node of the specified cpu. -1/errno on invalid cpu. */ int numa_node_of_cpu(int cpu); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numactl-2.0.13/numactl.8 new/numactl-2.0.14/numactl.8 --- old/numactl-2.0.13/numactl.8 2019-08-20 19:36:49.000000000 +0200 +++ new/numactl-2.0.14/numactl.8 2020-09-18 02:15:48.000000000 +0200 @@ -159,7 +159,7 @@ except N-N. If used with + notation, specify !+N-N. .TP .B \-\-localalloc, \-l -Always allocate on the current node. +Try to allocate on the current node of the process, but if memory cannot be allocated there fall back to other nodes. .TP .B \-\-preferred=node Preferably allocate memory on diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numactl-2.0.13/numactl.c new/numactl-2.0.14/numactl.c --- old/numactl-2.0.13/numactl.c 2019-08-30 01:27:06.000000000 +0200 +++ new/numactl-2.0.14/numactl.c 2020-09-18 02:15:48.000000000 +0200 @@ -23,6 +23,7 @@ #include <unistd.h> #include <stdarg.h> #include <ctype.h> +#include <assert.h> #include "numa.h" #include "numaif.h" #include "numaint.h" @@ -154,11 +155,9 @@ printf("preferred node: "); switch (policy) { case MPOL_PREFERRED: - if (prefnode != -1) { - printf("%ld\n", prefnode); - break; - } - /*FALL THROUGH*/ + assert(prefnode != -1); + printf("%ld\n", prefnode); + break; case MPOL_DEFAULT: printf("current\n"); break; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numactl-2.0.13/numademo.c new/numactl-2.0.14/numademo.c --- old/numactl-2.0.13/numademo.c 2019-08-30 01:27:06.000000000 +0200 +++ new/numactl-2.0.14/numademo.c 2020-09-18 02:15:48.000000000 +0200 @@ -301,7 +301,7 @@ int get_node_list(void) { int a, got_nodes = 0; - long free_node_sizes; + long long free_node_sizes; numnodes = numa_num_configured_nodes(); node_to_use = (int *)malloc(numnodes * sizeof(int)); @@ -378,7 +378,7 @@ } printf("setting preferred node to %d\n", node_to_use[i]); numa_set_preferred(node_to_use[i]); - memtest("memory without policy", numa_alloc(msize)); + memtest("memory with preferred policy", numa_alloc(msize)); } numa_set_interleave_mask(numa_all_nodes_ptr); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numactl-2.0.13/shm.c new/numactl-2.0.14/shm.c --- old/numactl-2.0.13/shm.c 2019-08-30 01:27:06.000000000 +0200 +++ new/numactl-2.0.14/shm.c 2020-09-18 02:15:48.000000000 +0200 @@ -119,7 +119,7 @@ shmlen = s.shm_segsz; } - shmptr = shmat(shmfd, NULL, SHM_RDONLY); + shmptr = shmat(shmfd, NULL, 0); if (shmptr == (void*)-1) err("shmat"); shmptr += shmoffset; @@ -134,7 +134,7 @@ { struct stat64 st; - shmfd = open(name, O_RDONLY); + shmfd = open(name, O_RDWR); if (shmfd < 0) { errno = 0; if (shmlen == 0) @@ -151,6 +151,7 @@ would be impossible to apply policy then. need to fix that in the kernel. */ perror("ftruncate"); + exit(1); } } @@ -160,7 +161,7 @@ /* RED-PEN For shmlen > address space may need to map in pieces. Left for some poor 32bit soul. */ - shmptr = mmap64(NULL, shmlen, PROT_READ, MAP_SHARED, shmfd, shmoffset); + shmptr = mmap64(NULL, shmlen, PROT_READ | PROT_WRITE, MAP_SHARED, shmfd, shmoffset); if (shmptr == (char*)-1) err("shm mmap"); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numactl-2.0.13/syscall.c new/numactl-2.0.14/syscall.c --- old/numactl-2.0.13/syscall.c 2019-08-30 01:27:06.000000000 +0200 +++ new/numactl-2.0.14/syscall.c 2020-09-18 02:26:29.000000000 +0200 @@ -20,6 +20,8 @@ #include "numa.h" #include "numaif.h" #include "numaint.h" +#include "config.h" +#include "util.h" #define WEAK __attribute__((weak)) @@ -238,26 +240,27 @@ } /* SLES8 glibc doesn't define those */ +SYMVER("numa_sched_setaffinity_v1", "numa_sched_setaffinity@libnuma_1.1") int numa_sched_setaffinity_v1(pid_t pid, unsigned len, const unsigned long *mask) { return syscall(__NR_sched_setaffinity,pid,len,mask); } -__asm__(".symver numa_sched_setaffinity_v1,numa_sched_setaffinity@libnuma_1.1"); +SYMVER("numa_sched_setaffinity_v2", "numa_sched_setaffinity@@libnuma_1.2") int numa_sched_setaffinity_v2(pid_t pid, struct bitmask *mask) { return syscall(__NR_sched_setaffinity, pid, numa_bitmask_nbytes(mask), mask->maskp); } -__asm__(".symver numa_sched_setaffinity_v2,numa_sched_setaffinity@@libnuma_1.2"); +SYMVER("numa_sched_getaffinity_v1", "numa_sched_getaffinity@libnuma_1.1") int numa_sched_getaffinity_v1(pid_t pid, unsigned len, const unsigned long *mask) { return syscall(__NR_sched_getaffinity,pid,len,mask); } -__asm__(".symver numa_sched_getaffinity_v1,numa_sched_getaffinity@libnuma_1.1"); +SYMVER("numa_sched_getaffinity_v2", "numa_sched_getaffinity@@libnuma_1.2") int numa_sched_getaffinity_v2(pid_t pid, struct bitmask *mask) { /* len is length in bytes */ @@ -266,7 +269,6 @@ /* sched_getaffinity returns sizeof(cpumask_t) */ } -__asm__(".symver numa_sched_getaffinity_v2,numa_sched_getaffinity@@libnuma_1.2"); make_internal_alias(numa_sched_getaffinity_v1); make_internal_alias(numa_sched_getaffinity_v2); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numactl-2.0.13/test/move_pages.c new/numactl-2.0.14/test/move_pages.c --- old/numactl-2.0.13/test/move_pages.c 2019-08-30 01:27:06.000000000 +0200 +++ new/numactl-2.0.14/test/move_pages.c 2020-09-18 02:08:51.000000000 +0200 @@ -26,7 +26,7 @@ int get_node_list() { int a, got_nodes = 0, max_node, numnodes; - long free_node_sizes; + long long free_node_sizes; numnodes = numa_num_configured_nodes(); node_to_use = (int *)malloc(numnodes * sizeof(int)); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numactl-2.0.13/util.h new/numactl-2.0.14/util.h --- old/numactl-2.0.13/util.h 2019-08-30 01:27:06.000000000 +0200 +++ new/numactl-2.0.14/util.h 2020-09-18 02:26:29.000000000 +0200 @@ -18,3 +18,9 @@ #define array_len(x) (sizeof(x)/sizeof(*(x))) #define round_up(x,y) (((x) + (y) - 1) & ~((y)-1)) + +#if HAVE_ATTRIBUTE_SYMVER +#define SYMVER(a,b) __attribute__ ((symver (b))) +#else +#define SYMVER(a,b) __asm__ (".symver " #a "," #b); +#endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/numactl-2.0.13/versions.ldscript new/numactl-2.0.14/versions.ldscript --- old/numactl-2.0.13/versions.ldscript 2019-08-20 20:06:13.000000000 +0200 +++ new/numactl-2.0.14/versions.ldscript 2020-09-18 02:08:51.000000000 +0200 @@ -60,6 +60,7 @@ numa_tonodemask_memory; numa_warn; numa_exit_on_warn; + numa_node_to_cpu_update; local: *; };