From owner-freebsd-hackers@freebsd.org Mon Mar 27 13:53:42 2017 Return-Path: Delivered-To: freebsd-hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3E0C7D1FB5D for ; Mon, 27 Mar 2017 13:53:42 +0000 (UTC) (envelope-from slw@zxy.spb.ru) Received: from zxy.spb.ru (zxy.spb.ru [195.70.199.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EABC76E7 for ; Mon, 27 Mar 2017 13:53:41 +0000 (UTC) (envelope-from slw@zxy.spb.ru) Received: from slw by zxy.spb.ru with local (Exim 4.86 (FreeBSD)) (envelope-from ) id 1csV5R-000Nqk-GO; Mon, 27 Mar 2017 16:53:33 +0300 Date: Mon, 27 Mar 2017 16:53:33 +0300 From: Slawa Olhovchenkov To: Alexander Tarasikov Cc: freebsd-hackers@freebsd.org Subject: Re: jmalloc in shared memory Message-ID: <20170327135333.GD70430@zxy.spb.ru> References: <20170320131235.GB86500@zxy.spb.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: slw@zxy.spb.ru X-SA-Exim-Scanned: No (on zxy.spb.ru); SAEximRunCond expanded to false X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 27 Mar 2017 13:53:42 -0000 On Mon, Mar 27, 2017 at 03:27:31PM +0200, Alexander Tarasikov wrote: > Hi Slawa, > I'm not sure jemalloc is supposed to be used this way, but you should > be able to achieve this functionality in two ways: > 1. Editing jemalloc's allocator ("src/pages.c") to allocate in your > region instead of calling mmap() > 2. Hook mmap() and brk(), sbrk() with LD_PRELOAD and provide > implementations that will allocate in the shared memory > > Hope this helps. I am don't need to redirect ALL allocations in the shared memory. I am need only do it for selected structures. For example, I am need create red-black tree and update it (in shared memory). For this, I am need create own memory management in this region or use existing memory management tool (for allocate, dealloacate and tracks chunks) worked for dedicated segment only. > On Mon, Mar 20, 2017 at 2:12 PM, Slawa Olhovchenkov wrote: > > How I can use jmalloc in shared memory? > > > > I.e. parent process do mmap w/ MAP_ANON|MAP_SHARED, create jmalloc > > "instance" in this memory and use jmalloc routines for memory management > > in this region. > > _______________________________________________ > > freebsd-hackers@freebsd.org mailing list > > https://lists.freebsd.org/mailman/listinfo/freebsd-hackers > > To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org" > > > > -- > Regards, Alexander