From patchwork Thu Aug 29 06:27:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Guo, Wangyang" X-Patchwork-Id: 1978233 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=k23g9cVh; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=8.43.85.97; helo=server2.sourceware.org; envelope-from=libc-alpha-bounces~incoming=patchwork.ozlabs.org@sourceware.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WvWcL2rZbz1yfy for ; Thu, 29 Aug 2024 16:30:25 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 8F565385EC55 for ; Thu, 29 Aug 2024 06:30:23 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.18]) by sourceware.org (Postfix) with ESMTPS id 7566D3858D39 for ; Thu, 29 Aug 2024 06:30:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7566D3858D39 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=intel.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 7566D3858D39 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=192.198.163.18 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1724913003; cv=none; b=Hos/5vmYFQ3TeF6iAqzyqCOjKuHv88sh3lHrN1WSFYL5nQN1OQfiVqCcA1okjt3Be+ZNmNLCBJuOkV6bYHmSpDSYHL+HMOMYPnHYR3O7OEQdoAHY+fK4EYZSuVRevBN+qkDQlPrz1yCYq29Zd8vCWEm5v9Gi+ecq/qW+l86v2h8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1724913003; c=relaxed/simple; bh=60qeToKzExKtL73oK35arR4WGL3kYgYQn9zsBkVxVBM=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=e/TUdtoyGPvQzQBosyMXM03cR/U31Vnnb2qZWuK2hJhxzI46n4jhfwEKCMfV1QIT9HerH5jyPar3K2RPuKSb/dBaDnk4Vp9o2hn1nT4i6Us/p322Zlm0cjEmHnbi82k228CdgbdFvzwxVqZeFOL/PcNRGkSW8lyjUoqdSJARchc= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1724913001; x=1756449001; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=60qeToKzExKtL73oK35arR4WGL3kYgYQn9zsBkVxVBM=; b=k23g9cVhnQ60Ub3hac9Q/OnOYnu1AkQHH76TqTCFK7rpJu57c9zkDuav mpiNzksmeeMS/5T0485TZXfH/N8IaBeDnvTGq/b9ZpmJjov70do1TxDfu HsUbRHOouczAm/9YVQlXmhbC+yNk2OtBynsS1kQL1ya7Dg0d7t0KH2iCD USQWknxO0z03iA9y+SPheBBSvT4GxbPDjtJMzdtoWMP7qlzHc+E6d4PHG 6jzIgRdLxWzewJrND7JdslJ4JUN+/mPu1JmVhSddGaM3LTCOKxQjWUQZE oUozac+NmlDoSjdh8RzsKnk2LuT4Pqs9Hc2KX5Xx9yh85V549ViAPogQj A==; X-CSE-ConnectionGUID: M2uOMJ/ZTq66rUcr4hoqAQ== X-CSE-MsgGUID: 2v4fYS2BRsyMH+3YUYKf3g== X-IronPort-AV: E=McAfee;i="6700,10204,11178"; a="22998328" X-IronPort-AV: E=Sophos;i="6.10,185,1719903600"; d="scan'208";a="22998328" Received: from fmviesa009.fm.intel.com ([10.60.135.149]) by fmvoesa112.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Aug 2024 23:30:00 -0700 X-CSE-ConnectionGUID: 1m4xNvZdR726rHxAIAcsfQ== X-CSE-MsgGUID: W3WWQF8OSGW+C8ZGOquAlA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.10,185,1719903600"; d="scan'208";a="63539120" Received: from linux-pnp-server-11.sh.intel.com ([10.239.176.178]) by fmviesa009.fm.intel.com with ESMTP; 28 Aug 2024 23:29:59 -0700 From: Wangyang Guo To: libc-alpha@sourceware.org Cc: fweimer@redhat.com, goldstein.w.n@gmail.com, tianyou.li@intel.com, Wangyang Guo Subject: [PATCH v3 0/5] malloc: TCACHE improvement for free and calloc Date: Thu, 29 Aug 2024 14:27:27 +0800 Message-ID: <20240829062732.1663342-1-wangyang.guo@intel.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-Spam-Status: No, score=-5.5 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces~incoming=patchwork.ozlabs.org@sourceware.org This series aims to improve TCACHE performance in memory allocator: simplify TCACHE code path in free() and add TCACHE support for calloc(). --- Changes in v3: - Add comments to the split functions. - Wrap out seldom executed tcache_double_free_verify() as noinline function. - Split out tcache_available() as helper function. - Link to v2: https://sourceware.org/pipermail/libc-alpha/2024-August/159425.html Changes in v2: - _int_free_check() should be put outside of USE_TCACHE. - Merge tst-safe-linking fix into commit#5 to make sure CI check pass. - Link to v1: https://sourceware.org/pipermail/libc-alpha/2024-August/159357.html Wangyang Guo (5): malloc: Split _int_free() into 3 sub functions malloc: Avoid func call for tcache quick path in free() malloc: Arena is not needed for tcache path in free() benchtests: Add calloc function test to bench-malloc-thread malloc: Add tcache path for calloc benchtests/bench-malloc-thread.c | 114 ++++++++----- malloc/malloc.c | 280 ++++++++++++++++++++----------- malloc/tst-safe-linking.c | 81 +++++++-- 3 files changed, 327 insertions(+), 148 deletions(-)