From owner-freebsd-hackers@freebsd.org Mon Mar 27 13:27:32 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 E4DDBD1F045 for ; Mon, 27 Mar 2017 13:27:32 +0000 (UTC) (envelope-from alexander.tarasikov@gmail.com) Received: from mail-ot0-x235.google.com (mail-ot0-x235.google.com [IPv6:2607:f8b0:4003:c0f::235]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A9265FEE for ; Mon, 27 Mar 2017 13:27:32 +0000 (UTC) (envelope-from alexander.tarasikov@gmail.com) Received: by mail-ot0-x235.google.com with SMTP id t8so25670837otf.3 for ; Mon, 27 Mar 2017 06:27:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=dVpQjtVMTq7Kmteax2mxCfVQjnpZIMCVG9/YDfnVD8w=; b=aNR30YhsLgfVxWVu6KBFCAg/fmSa4W5iBLvfagJe3z7Do19bZDhbN8T8SIUbJpJQ2+ i7h4V+/USsqntZMdNsMn0BjOdT5tJyiUPTaP3qc9hpq7nIxp5MCwJEM93gYT9sC9ITXO S3JnNRupB1froAoh1rgQDMbnvuuUwtCkEQlYwKywo6TD/pBhTLCR4m+NAun2EPDeB3Xi CsfR3rZ4PdufAxPwM1ylixgbL4qxZCrQr5Uft1m4Fr5z0ypAXPr6j0Fv1q/43F5wajMH +oIXnQeLXjNATiF4T5x8GjNouJaCV7WTPd5LCXF+0fzxwYC9ogPKw8nX+089WeAS3GHU d7Ng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=dVpQjtVMTq7Kmteax2mxCfVQjnpZIMCVG9/YDfnVD8w=; b=AIBhzLRa2csfN419YDqIu3FaODng53bdFuoagUx9jXn5eOSbG4+5VRZJtkzEDpAOV7 Zaed9Pn+vOrSU2dAi+MIyxNXcX0/asRIFyBS1dLt4XVkVkYFOHujl56tHAnIkrmuFtiW uEPYGT31VpRzHQHz6Eget9QNVYrOFpAc4/VbrhQJZfi2spr2AACS45zxVYGq4UDUQREz wm4FFi1aMnFl7pwdPUw94tWN3D4mLccLQhxVeX33RolYzzrP2XWk30aJ5hDMgs08LXCa 40kPRxPSlgbPxnKqWT9FmBnPSI4epE6sTZBgRm4IpQ1sKKM2V9NnSbSYs81Dq4deiZPN ngNw== X-Gm-Message-State: AFeK/H3xNVxtjbvFwRqCQURZPtJVnoMPkJJ5/VQvygOfVUK8WGGnQlEeP468/LHIXc40n8gIzNJ/UTAPxtHsIA== X-Received: by 10.157.83.27 with SMTP id g27mr12481765oth.160.1490621252003; Mon, 27 Mar 2017 06:27:32 -0700 (PDT) MIME-Version: 1.0 Received: by 10.182.102.10 with HTTP; Mon, 27 Mar 2017 06:27:31 -0700 (PDT) In-Reply-To: <20170320131235.GB86500@zxy.spb.ru> References: <20170320131235.GB86500@zxy.spb.ru> From: Alexander Tarasikov Date: Mon, 27 Mar 2017 15:27:31 +0200 Message-ID: Subject: Re: jmalloc in shared memory To: Slawa Olhovchenkov Cc: freebsd-hackers@freebsd.org Content-Type: text/plain; charset=UTF-8 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:27:33 -0000 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. 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