From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: DJ Delorie Newsgroups: gmane.comp.lib.glibc.alpha Subject: Re: [PATCH v2] Add malloc micro benchmark Date: Wed, 28 Feb 2018 16:56:28 -0500 Message-ID: References: <20180228195645.GA26707@domone> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 8bit X-Trace: blaine.gmane.org 1519854888 3954 195.159.176.226 (28 Feb 2018 21:54:48 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 28 Feb 2018 21:54:48 +0000 (UTC) Cc: libc-alpha@sourceware.org To: OndÅ™ej Bílka Original-X-From: libc-alpha-return-90690-glibc-alpha=m.gmane.org@sourceware.org Wed Feb 28 22:54:44 2018 Return-path: Envelope-to: glibc-alpha@blaine.gmane.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:in-reply-to:date:message-id :mime-version:content-type:content-transfer-encoding; q=dns; s= default; b=u6ylmi7npmbxZs4E+1/Crr3FRderzvN0QGHHg6zsaPzCS3h87/JuF Cx+D5oy6ojDhCX587b8IWXHZS+AaQ4xxJMfzVXvaDUSpQA8+kjUTNlO4AcorlsHw 9kHoc0HYabPSf8EXqGf5MuCiEDUVjbzGec0cJ7Hifzy2jRVx49ukAc= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:in-reply-to:date:message-id :mime-version:content-type:content-transfer-encoding; s=default; bh=ReWja1JuHzlwfNUFdT1YUUUgev0=; b=GUNg9wKh3j+VuKx15Tjxcaoe8prH WWsGEsrtqRs1ePMYVjbKWnkaQvbrcyVyZDw4GhORlWaimv6fN514E6bFclYjfVFu fB1LLVuzT9z64T8QJg0kAVO4jI8cA/M6cu80YMt+JsmjWQTB7LlIEUuBYHUMQsXJ qNF53U3srH97QKQ= Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Original-Sender: libc-alpha-owner@sourceware.org Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=D*seznam.cz, footprint, HContent-Transfer-Encoding:8bit, research X-HELO: mx1.redhat.com In-Reply-To: <20180228195645.GA26707@domone> (message from OndÅ™ej Bílka on Wed, 28 Feb 2018 20:56:45 +0100) Xref: news.gmane.org gmane.comp.lib.glibc.alpha:83021 Archived-At: Received: from server1.sourceware.org ([209.132.180.131] helo=sourceware.org) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1er9gR-0000VY-Ul for glibc-alpha@blaine.gmane.org; Wed, 28 Feb 2018 22:54:44 +0100 Received: (qmail 41664 invoked by alias); 28 Feb 2018 21:56:39 -0000 Received: (qmail 41576 invoked by uid 89); 28 Feb 2018 21:56:39 -0000 Ond™ej B­lka writes: > First for small sizes allocation would be just popping element from > thread local single linked list, or calling function to refill lists > with enough elements when empty. This is basically what tcache does. Although I tested a few ways of pre-filling the cache, there's room for more research there beyond the few algorithms I used. Some folks have been experimenting with "ideal" values for tcache_count and tcache_max too. > Finally for larger allocations I would use page-based logic as > mmaping/remapping/unmapping is about only way to actually decrease > memory footprint, I didn't try that much yet. Note that mmap() itself is expensive (slow) and there may be a limit on how many discrete mapped regions a kernel[*] can support. [*] glibc is not limited to the Linux kernel, so beware...