diff --git a/.gitignore b/.gitignore index e69de29..ac4ca64 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1,2 @@ +/jemalloc-8a46c970035ada0154f302418cb436de49606231.tar.gz +/memkind-35c83cee96432edc0b5b21680535a2f2b77a1801.tar.gz diff --git a/0001-memkind-pmtt-stop-nuking-sysconfdir-and-contents.patch b/0001-memkind-pmtt-stop-nuking-sysconfdir-and-contents.patch new file mode 100644 index 0000000..e85ac24 --- /dev/null +++ b/0001-memkind-pmtt-stop-nuking-sysconfdir-and-contents.patch @@ -0,0 +1,68 @@ +From 74f8dd6193fe1ae1e475452a76f9c4daaf602a63 Mon Sep 17 00:00:00 2001 +Message-Id: <74f8dd6193fe1ae1e475452a76f9c4daaf602a63.1431444153.git.aquini@redhat.com> +From: Rafael Aquini +Date: Tue, 12 May 2015 11:22:30 -0400 +Subject: [PATCH] memkind-pmtt: stop nuking sysconfdir and contents + +memkind-pmtt tool should not be nuking the sysconfdir -- /etc/memkind -- +in order to not overlap content ownership with package managers such RPM +as well as to avoid crazy havocs of racy file and dir unlinks with concurrent +usage from the libs or other parses via parallel memkind-pmtt invocations. + +This patch removes the sysconfdir nuking points for the memkind-pmtt tool and +its sysv init script as well as it delegates the 'MEMKIND_FILE' file deletion +control only to the sysv init script for procedural consistency. + +Signed-off-by: Rafael Aquini +--- + init.d/memkind | 8 -------- + src/memkind_pmtt.c | 7 ------- + 2 files changed, 15 deletions(-) + +diff --git a/init.d/memkind b/init.d/memkind +index 1be0954..2ba6745 100755 +--- a/init.d/memkind ++++ b/init.d/memkind +@@ -90,14 +90,6 @@ stop() { + if [ $err -eq 0 ] && [ ! -f $MEMKIND_FILE ] + then + echo_success "deleted file: $MEMKIND_FILE" +- rmdir $MEMKIND_DIR +- err=$? +- if [ $err -eq 0 ] && [ ! -d $MEMKIND_DIR ] +- then +- echo_success "deleted directory: $MEMKIND_DIR" +- else +- echo_failure "could not delete directory: $MEMKIND_DIR" +- fi + else + echo_failure "could not delete file: $MEMKIND_FILE" + fi +diff --git a/src/memkind_pmtt.c b/src/memkind_pmtt.c +index ebabafd..9d9296c 100644 +--- a/src/memkind_pmtt.c ++++ b/src/memkind_pmtt.c +@@ -220,7 +220,6 @@ int memkind_pmtt(char *pmtt_path, char *bandwidth_path) + err = errno ? -errno : 1; + goto exit; + } +- unlink(bandwidth_path); + fd = open(bandwidth_path, O_CREAT | O_EXCL | O_WRONLY, 0644); + if (fd == -1) { + fprintf(stderr, "ERROR: opening %s for writing\n", bandwidth_path); +@@ -252,12 +251,6 @@ exit: + if (bandwidth != NULL) { + free(bandwidth); + } +- if (err) { +- unlink(bandwidth_path); +- if(*dir) { +- rmdir(dir); +- } +- } + return err; + } + +-- +2.1.0 + diff --git a/0002-memkind-configure.ac-fix-obsolete-macro-usage-warnin.patch b/0002-memkind-configure.ac-fix-obsolete-macro-usage-warnin.patch new file mode 100644 index 0000000..030e9a1 --- /dev/null +++ b/0002-memkind-configure.ac-fix-obsolete-macro-usage-warnin.patch @@ -0,0 +1,80 @@ +From 0de5d76fa06c027ff17790c871e57c939b14bea4 Mon Sep 17 00:00:00 2001 +Message-Id: <0de5d76fa06c027ff17790c871e57c939b14bea4.1432566145.git.aquini@redhat.com> +In-Reply-To: <74f8dd6193fe1ae1e475452a76f9c4daaf602a63.1432566145.git.aquini@redhat.com> +References: <74f8dd6193fe1ae1e475452a76f9c4daaf602a63.1432566145.git.aquini@redhat.com> +From: Rafael Aquini +Date: Mon, 25 May 2015 10:31:01 -0400 +Subject: [PATCH 2/2] memkind: configure.ac fix obsolete macro usage warnings + +This patch adjusts memkind's configure.ac file to get rid of the following +warnings when autotools are executed with '-Wobsolete' flag + +-- >8 -- +$ ./autogen.sh +~/rpmbuild/BUILD/memkind-a0dfc8ad94960babcdaf99063164f9b64b1092e4/jemalloc ~/rpmbuild/BUILD/memkind-a0dfc8ad94960babcdaf99063164f9b64b1092e4 +~/rpmbuild/BUILD/memkind-a0dfc8ad94960babcdaf99063164f9b64b1092e4 +configure.ac:140: warning: The macro `AC_PROG_LIBTOOL' is obsolete. +configure.ac:140: You should run autoupdate. +m4/libtool.m4:107: AC_PROG_LIBTOOL is expanded from... +configure.ac:140: the top level +configure.ac:178: warning: AC_OUTPUT should be used without arguments. +configure.ac:178: You should run autoupdate. +libtoolize: putting auxiliary files in `.'. +libtoolize: copying file `./ltmain.sh' +libtoolize: putting macros in `m4'. +libtoolize: copying file `m4/libtool.m4' +libtoolize: copying file `m4/ltoptions.m4' +libtoolize: copying file `m4/ltsugar.m4' +libtoolize: copying file `m4/ltversion.m4' +libtoolize: copying file `m4/lt~obsolete.m4' +libtoolize: Consider adding `AC_CONFIG_MACRO_DIR([m4])' to configure.ac and +libtoolize: rerunning libtoolize, to keep the correct libtool macros in-tree. +libtoolize: `AC_PROG_RANLIB' is rendered obsolete by `LT_INIT' +configure.ac:140: warning: The macro `AC_PROG_LIBTOOL' is obsolete. +configure.ac:140: You should run autoupdate. +m4/libtool.m4:107: AC_PROG_LIBTOOL is expanded from... +configure.ac:140: the top level +configure.ac:178: warning: AC_OUTPUT should be used without arguments. +configure.ac:178: You should run autoupdate. +-- 8< -- + +Signed-off-by: Rafael Aquini +--- + configure.ac | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +diff --git a/configure.ac b/configure.ac +index 465eba9..24c7840 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -30,6 +30,7 @@ AC_INIT([memkind],m4_esyscmd([tr -d '\n' < VERSION]),[christopher.m.cantalupo@in + AM_INIT_AUTOMAKE([-Wall -Werror foreign subdir-objects tar-pax]) + AC_CONFIG_HEADERS([config.h]) + AC_CONFIG_HEADERS([config_tls.h]) ++AC_CONFIG_MACRO_DIR([m4]) + + memkind_abi_version=0:1:0 + AC_SUBST(memkind_abi_version) +@@ -137,8 +138,7 @@ AC_PROG_CPP + AC_PROG_INSTALL + AC_PROG_LN_S + AC_PROG_MAKE_SET +-AC_PROG_LIBTOOL +-AC_PROG_RANLIB ++LT_INIT + AM_PROG_CC_C_O + + # Checks for libraries. +@@ -175,7 +175,8 @@ AC_FUNC_MMAP + AC_FUNC_REALLOC + AC_CHECK_FUNCS([gettimeofday memset mkdir munmap setenv strtol strtoul]) + +-AC_OUTPUT(Makefile) ++AC_CONFIG_FILES([Makefile]) ++AC_OUTPUT + + # ============================================================================ + # Print out the results of configuration. +-- +2.1.0 + diff --git a/memkind.spec b/memkind.spec new file mode 100644 index 0000000..15b776b --- /dev/null +++ b/memkind.spec @@ -0,0 +1,141 @@ +%global commit 35c83cee96432edc0b5b21680535a2f2b77a1801 +%global commit2 8a46c970035ada0154f302418cb436de49606231 +%global checkout .20150525git + +Name: memkind +Summary: User Extensible Heap Manager +Version: 0.2.2 +Release: 3%{?checkout}%{?dist} +License: BSD +Group: System Environment/Libraries +URL: http://memkind.github.io/memkind +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) +BuildRequires: automake libtool numactl-devel + +# x86_64 is the only arch memkind will build due to its +# current dependency on SSE4.2 CRC32 instruction which +# is used to compute thread local storage arena mappings +# with polynomial accumulations via GCC's intrinsic _mm_crc32_u64 +# For further info check: +# - /lib/gcc///include/smmintrin.h +# - https://gcc.gnu.org/bugzilla/show_bug.cgi?id=36095 +# - http://en.wikipedia.org/wiki/SSE4 +ExclusiveArch: x86_64 + +# The two source tarballs for this package were pulled from upstream +Source0: https://github.com/%{name}/%{name}/archive/%{commit}/%{name}-%{commit}.tar.gz +Source1: https://github.com/%{name}/jemalloc/archive/%{commit2}/jemalloc-%{commit2}.tar.gz + +# https://github.com/memkind/memkind/issues/3 +Patch0: 0001-memkind-pmtt-stop-nuking-sysconfdir-and-contents.patch +# https://github.com/memkind/memkind/issues/4 +Patch1: 0002-memkind-configure.ac-fix-obsolete-macro-usage-warnin.patch + +%description +The memkind library is an user extensible heap manager built on top of +jemalloc which enables control of memory characteristics and a +partitioning of the heap between kinds of memory. The kinds of memory +are defined by operating system memory policies that have been applied +to virtual address ranges. Memory characteristics supported by +memkind without user extension include control of NUMA and page size +features. The jemalloc non-standard interface has been extended to +enable specialized arenas to make requests for virtual memory from the +operating system through the memkind partition interface. Through the +other memkind interfaces the user can control and extend memory +partition features and allocate memory while selecting enabled +features. This software is being made available for early evaluation. +Feedback on design or implementation is greatly appreciated. + +%package devel +Summary: Memkind User Extensible Heap Manager development lib and tools +Group: Development/Libraries +Requires: %{name} = %{version}-%{release} + +%description devel +Install header files and development aids to link memkind library +into applications. The memkind library is an user extensible heap manager +built on top of jemalloc which enables control of memory characteristics and +heap partitioning on different kinds of memory. This software is being made +available for early evaluation. The memkind library should be considered +pre-alpha: bugs may exist and the interfaces may be subject to change prior to +alpha release. Feedback on design or implementation is greatly appreciated. + +%prep +%setup -q -a 0 -n %{name}-%{commit} +%setup -q -a 1 -n %{name}-%{commit} +cd %{_builddir}/%{name}-%{commit}/ +rmdir %{_builddir}/%{name}-%{commit}/jemalloc/ +mv jemalloc-%{commit2}/ jemalloc/ +%patch0 -p1 -b .patch0.bkp +%patch1 -p1 -b .patch1.bkp + +%build +# It is required that we configure and build the jemalloc subdirectory +# before we configure and start building the top level memkind directory. +# To ensure the memkind build step is able to discover the output +# of the jemalloc build we must create an 'obj' directory, and build +# from within that directory. +cd %{_builddir}/%{name}-%{commit}/jemalloc/ +echo %{version} > %{_builddir}/%{name}-%{commit}/jemalloc/VERSION +test -f configure || %{__autoconf} +mkdir %{_builddir}/%{name}-%{commit}/jemalloc/obj +ln -s %{_builddir}/%{name}-%{commit}/jemalloc/configure \ + %{_builddir}/%{name}-%{commit}/jemalloc/obj/ +cd %{_builddir}/%{name}-%{commit}/jemalloc/obj +%configure --enable-autogen --with-jemalloc-prefix=jemk_ --enable-memkind \ + --enable-safe --enable-cc-silence --prefix=%{_prefix} \ + --includedir=%{_includedir} --libdir=%{_libdir} \ + --bindir=%{_bindir} --docdir=%{_docdir}/%{name} \ + --mandir=%{_mandir} CFLAGS="$RPM_OPT_FLAGS -std=gnu99" +%{__make} %{?_smp_mflags} + +# Build memkind lib and tools +cd %{_builddir}/%{name}-%{commit} +echo %{version} > %{_builddir}/%{name}-%{commit}/VERSION +touch %{_builddir}/%{name}-%{commit}/jemalloc/.git +test -f configure || ./autogen.sh +%configure --enable-tls --prefix=%{_prefix} --libdir=%{_libdir} \ + --includedir=%{_includedir} --sbindir=%{_sbindir} \ + --mandir=%{_mandir} --docdir=%{_docdir}/%{name} \ + CFLAGS="$RPM_OPT_FLAGS -std=gnu99" +%{__make} %{?_smp_mflags} + +%install +cd %{_builddir}/%{name}-%{commit} +%{__make} DESTDIR=%{buildroot} install +mkdir -p %{buildroot}/%{_sysconfdir}/%{name} +rm -f %{buildroot}/%{_libdir}/lib%{name}.{l,}a +rm -f %{buildroot}/%{_libdir}/lib{numakind,autohbw}.* +rm -f %{buildroot}/%{_docdir}/%{name}/VERSION + +%post -p /sbin/ldconfig + +%postun -p /sbin/ldconfig + +%files +%defattr(-,root,root,-) +%license %{_docdir}/%{name}/COPYING +%doc %{_docdir}/%{name}/README +%dir %{_sysconfdir}/%{name} +%dir %{_docdir}/%{name} +%{_libdir}/lib%{name}.so.* +%{_bindir}/%{name}-hbw-nodes +%{_sbindir}/%{name}-pmtt + +%files devel +%defattr(-,root,root,-) +%{_includedir}/%{name}*.h +%{_includedir}/hbwmalloc.h +%{_libdir}/lib%{name}.so +%{_mandir}/man3/hbwmalloc.3.* +%{_mandir}/man3/%{name}*.3.* + +%changelog +* Mon May 25 2015 Rafael Aquini - 0.2.2-3%{?checkout} +- Get rid of obsolete m4 macros usage on autotool scripts + +* Mon May 18 2015 Rafael Aquini - 0.2.2-2%{?checkout} +- Fix to BuildRequires and License Text Marker in spec file (1222709#c1) + +* Mon May 18 2015 Rafael Aquini - 0.2.2-1%{?checkout} +- Initial RPM packaging for Fedora diff --git a/sources b/sources index e69de29..23f361d 100644 --- a/sources +++ b/sources @@ -0,0 +1,2 @@ +5297a615a607154e67d4989652b5f1d0 jemalloc-8a46c970035ada0154f302418cb436de49606231.tar.gz +552cbac904655882cabbdde1a13a7d64 memkind-35c83cee96432edc0b5b21680535a2f2b77a1801.tar.gz