From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Return-Path: Date: Wed, 15 May 2019 15:53:04 +0300 From: Cyrill Gorcunov Subject: Re: [PATCH v3] slab_arena: Enhance slab_arena_create to support madvise hints Message-ID: <20190515125304.GC2952@uranus.lan> References: <20190513200126.7584-1-gorcunov@gmail.com> <20190515123756.6jmoyzm7kf7fahzp@esperanza> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190515123756.6jmoyzm7kf7fahzp@esperanza> To: Vladimir Davydov Cc: tml , Alexander Turenko List-ID: On Wed, May 15, 2019 at 03:37:56PM +0300, Vladimir Davydov wrote: > > I'd also patch all places (tests, etc) where old flags (MAP_*) are used > to switch them to new flags. Sooner or later we should drop this compat > layer. Maybe we should do this in a separate patch? I would like the tests to sit for some time with MAP_ flags to make sure everything works. And I'll prepare the patch covering MAP_ next week, sounds OK? > > -#if !defined(MAP_ANONYMOUS) > > -#define MAP_ANONYMOUS MAP_ANON > > +static void > > +madvise_checked(void *ptr, size_t size, int flags) > > +{ > > +#ifdef TARANTOOL_SMALL_USE_MADVISE > > It would be nice to have a warning in case MADV_DONTDUMP is unavailable. > It should be printed only once. May be, here, or, even better, in > Tarantool itself (via say_warn()). You know I thought if we could use small/conf.h inside tarantool. For this sake I prefixed symbols with TARANROOL_SMALL_ to not interfere with any other symbols. Another option -- provide something like static const uint64_t small_features = (bitset of features); bool small_have_feature(uint64_t mask) { return small_features & mask; } ? > > > > static void > > munmap_checked(void *addr, size_t size) > > { > > if (munmap(addr, size)) { > > char buf[64]; > > - intptr_t ignore_it = (intptr_t)strerror_r(errno, buf, > > - sizeof(buf)); > > + char *ignore_it = strerror_r(errno, buf, sizeof(buf)); > > This wouldn't compile on OS X. Please leave it as is. Same's fair for > madvise_checked. The problem is that if I leave it as is it doesn't compile on linux, due to _GNU_SOURCE definition, which is required for MADV_ flags :/