From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Mon, 6 May 2019 16:46:59 +0300 From: Alexander Turenko Subject: Re: [PATCH 2/3] slab_arena: Provide slab_arena_madvise_create to madvice slabs Message-ID: <20190506134659.2e7ancyjjz7k6pyh@tkn_work_nb> References: <20190501155006.14546-1-gorcunov@gmail.com> <20190501155006.14546-3-gorcunov@gmail.com> <20190506103836.gxvrre4upkga7tej@esperanza> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20190506103836.gxvrre4upkga7tej@esperanza> To: Vladimir Davydov Cc: Cyrill Gorcunov , tml List-ID: > > +#ifdef TARANTOOL_SMALL_HAS_MADVISE > > +/** > > + * slab_arena_madvise_create - Initialize madvise permanent strategy > > + * @arena: slab arena to madvise > > + * @advice: strategy (MADV_DONTDUMP, ...) > > + * > > + * This function setups @slab_arena strategy so that new memory > > + * allocation with mmap() call gets madvise() call with @advice. > > + * > > + * Note that we don't allow to change strategy once choosen because > > + * otherwise we need to walk over all possible slab cache entry. > > + * > > + * This function should be called right after the slab arena creation, > > + * otherwise if called later some of the non-preallocated slabs won't be > > + * madvise'd. > > + */ > > +int > > +slab_arena_madvise_create(struct slab_arena *arena, int advice) > > I don't see much point in changing madvise settings on the fly. > Let's instead allow to pass DONTDUMP flag at creation time. > This means we have to combine MAP_ and MADV_ flags. I guess it > was a bad idea to pass MAP_ flags directly to small_create() in > the first place. What about introducing small-specific flags like > > SLAB_ARENA_SHARED > SLAB_ARENA_DONTDUMP > > Come to think of it, I assume we don't even need to introduce > SLAB_ARENA_SHARED - we always pass MAP_PRIVATE to small_create(). > Let's drop it, perhaps? > > It will break backward compatibility, but I don't think it really > matters, as tarantool/small is only used by tarantool - it isn't > a big deal if we change its API. We only need to bump the version > number, I guess. > > Alexander, please amend me if I'm wrong. I don't know other users of the library, so incompatiable changes looks okay. I would release a new version (an annotated tag + a github release) and mention incompatible changes to let potential users know about this. Maybe this is too formal, don't know :) WBR, Alexander Turenko.