From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-yk0-f177.google.com (mail-yk0-f177.google.com [209.85.160.177]) by dpdk.org (Postfix) with ESMTP id C15AA47D2 for ; Mon, 23 Jun 2014 23:17:19 +0200 (CEST) Received: by mail-yk0-f177.google.com with SMTP id 10so5069431ykt.22 for ; Mon, 23 Jun 2014 14:17:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id:in-reply-to:references; bh=t1iInKEKg8YsbXYXh8OEnh/WOkWB2sy5B7udRWK0MZ8=; b=kbQusorFW2KtRxH9EVB9I8WPLnXTwDYns4tPTy9AKpgeX+T9crVTu79XQNv72c3BhA cQofWJ8AkKin59NqZggkfQzAEWIJb6uCBHrjktZysHPen30APfJcPYLVECxluw8Eb82G OulYtZ8h2O+V0iU7IXXUY0qr8iIcfYC6QCTMlRqCxc8EvRdHs2EJkYDMylOZ/+2YVhEt G38eU5133dNyxNP7Yi5NrfOPepRNyE0qow82k0fGRKjR6Zb4Ei9ebfNY/odYIWaBG9Df 5J5yDt0xWeKQIWJwLuGM8sWITRCvSDF8sENiZ4dEOS7DpIShWuN9Q7Jt+/nRsTAvkalW baQw== X-Received: by 10.236.27.33 with SMTP id d21mr39086949yha.82.1403558257502; Mon, 23 Jun 2014 14:17:37 -0700 (PDT) Received: from localhost.localdomain ([69.80.69.242]) by mx.google.com with ESMTPSA id m25sm31531405yhc.12.2014.06.23.14.17.36 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 23 Jun 2014 14:17:36 -0700 (PDT) From: Robert Sanford To: dev@dpdk.org Date: Mon, 23 Jun 2014 17:17:08 -0400 Message-Id: <1403558230-40042-1-git-send-email-rsanford2@gmail.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1400245141-10938-1-git-send-email-rsanford2@gmail.com> References: <1400245141-10938-1-git-send-email-rsanford2@gmail.com> Subject: [dpdk-dev] [PATCH v3 0/2] malloc: fix malloc and free linear complexity X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Jun 2014 21:17:20 -0000 Comments on previous versions of this patch: http://dpdk.org/ml/archives/dev/2014-May/002297.html http://dpdk.org/ml/archives/dev/2014-June/003518.html Additional changes from original to v3: * Reduce the minimum-sized block that we put on a free list when splitting a larger block, from 192 to 64. Although memory is plentiful, why waste 64 and 128-byte (plus overhead) blocks? -#define MIN_DATA_SIZE (CACHE_LINE_SIZE * 2) +#define MIN_DATA_SIZE (CACHE_LINE_SIZE) - if (old_elem_size <= MALLOC_ELEM_OVERHEAD + MIN_DATA_SIZE){ + if (old_elem_size < MALLOC_ELEM_OVERHEAD + MIN_DATA_SIZE){ - if (elem->size - new_size > MIN_DATA_SIZE + MALLOC_ELEM_OVERHEAD){ + if (elem->size - new_size >= MIN_DATA_SIZE + MALLOC_ELEM_OVERHEAD){ Changes from v2 to v3: * Change the size ranges of the five free lists per heap. The first list will effectively contain blocks of size [64,256]. - * heap->free_head[0] - (0 , 2^7] - * heap->free_head[1] - (2^7 , 2^9] - * heap->free_head[2] - (2^9 , 2^11] - * heap->free_head[3] - (2^11, 2^13] - * heap->free_head[4] - (2^13, MAX_SIZE] + * heap->free_head[0] - (0 , 2^8] + * heap->free_head[1] - (2^8 , 2^10] + * heap->free_head[2] - (2^10 ,2^12] + * heap->free_head[3] - (2^12, 2^14] + * heap->free_head[4] - (2^14, MAX_SIZE] - #define MALLOC_MINSIZE_LOG2 7 + #define MALLOC_MINSIZE_LOG2 8 * Fix typos and false assumptions in malloc unit tests. Even without linked-list enhancements to lib rte_malloc, malloc autotest fails every second (2nd) run.