Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp5760940pxu; Thu, 22 Oct 2020 10:18:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJytLfsydy5JXF/vapk40KKeJ9fAAx6TyWK9LLtaSZG47M4xNuTudC1iEJ7m3A8EanlGh797 X-Received: by 2002:a50:88e5:: with SMTP id d92mr3224878edd.145.1603387132804; Thu, 22 Oct 2020 10:18:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603387132; cv=none; d=google.com; s=arc-20160816; b=ZKS3c+gRFD+esRCOMmGULf4LROMeBtU0lvJQN/Vcr2WqwKXsyJJShxVOkomB0dpnBD V0AZ63idYtbGkHjrF+kTeC/wZTYeyrJ3zxiKQ4I9czhyA/3IDMpDITnDXSljeoIOZfTI rocu8xAIOT/3Grsy36jl2mqt6ntvY5gZo4gzUAXlPaNlPA2gJPaRUeNWwZ8pIFOjL3jy goURjmyUs00kmGwpsQHlZ/B4DBmlcWaDY3aTRshHJbDo6at41zCX+akIslziKBPe5Eoa sKXGUEKFwwJpNw6mjDsnXDIH8yEVBAXYYhIalEYdT44kM4h4HqAutcV7vcxmuBO4dHCB uL9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from:dmarc-filter :sender:dkim-signature; bh=Ipi9ynr+xEPqZ69xhwJ6Rw5nRW7OtUtZcKIzdGosVlM=; b=Mo4IxkPTyuzm1/IUj+2MRcNU3gW/nIrzQPdzFMwDQ6PaERZBM8LjksB46Gh2jM0un5 O3KL9AcRxYLV2XUHUbv29dkdsB5Dl732s1FyNTZGl/cE0R6zeusWTIx5mnRDmUJr0xhw f1XXq73J7KdYQhY2j9dI7toj+bjxei4A8+IJ7Wl4U0t4afG86UOXgnI77AfxM1A720Ew qamZ56tgn9wsyPiGb5P56lyZjUxhYk6w6r8bIzD+Fu6pSY9eTq7ppjLw1enKuBVgdy4N FiIXrPDPvZbauBI9Kk7Uyi5nRzeAd7AAKvUd41eSW9Q5p3ovhVkEVKSMHeagDG/AfaBb wQ2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=ZNFH3MsA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e12si1330431ejr.549.2020.10.22.10.18.30; Thu, 22 Oct 2020 10:18:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=ZNFH3MsA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2899432AbgJVNQ5 (ORCPT + 99 others); Thu, 22 Oct 2020 09:16:57 -0400 Received: from z5.mailgun.us ([104.130.96.5]:15070 "EHLO z5.mailgun.us" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2442003AbgJVNQy (ORCPT ); Thu, 22 Oct 2020 09:16:54 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1603372614; h=Message-Id: Date: Subject: Cc: To: From: Sender; bh=Ipi9ynr+xEPqZ69xhwJ6Rw5nRW7OtUtZcKIzdGosVlM=; b=ZNFH3MsAtB3COEd3crRJYp+9Uq3RzvI/l+rqeNBMdMS0MUx1f6kMCg5IE75tfSIkIoNjjw0m IhQBJ9YPlW31ST9Z40BnygYUqytXAxji1GWbciUCs5HshIVS/3/XsY2njaBJJNLmJIRN6Dma JY233nU/+JJl2Qmv3VsEK09t9Ts= X-Mailgun-Sending-Ip: 104.130.96.5 X-Mailgun-Sid: WyI0MWYwYSIsICJsaW51eC1rZXJuZWxAdmdlci5rZXJuZWwub3JnIiwgImJlOWU0YSJd Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n03.prod.us-east-1.postgun.com with SMTP id 5f918620d63768e57b18fbfc (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Thu, 22 Oct 2020 13:16:16 GMT Sender: vjitta=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 7EC5EC433FF; Thu, 22 Oct 2020 13:16:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=ALL_TRUSTED,BAYES_00,SPF_FAIL, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from vjitta-linux.qualcomm.com (unknown [202.46.22.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: vjitta) by smtp.codeaurora.org (Postfix) with ESMTPSA id 761D5C433C9; Thu, 22 Oct 2020 13:16:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 761D5C433C9 Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=fail smtp.mailfrom=vjitta@codeaurora.org From: vjitta@codeaurora.org To: glider@google.com, dan.j.williams@intel.com, broonie@kernel.org, mhiramat@kernel.org Cc: linux-kernel@vger.kernel.org, akpm@linux-foundation.org, vjitta@codeaurora.org, Yogesh Lal , Vinayak Menon Subject: [PATCH] lib: stackdepot: Add support to configure STACK_HASH_SIZE Date: Thu, 22 Oct 2020 18:45:46 +0530 Message-Id: <1603372546-27118-1-git-send-email-vjitta@codeaurora.org> X-Mailer: git-send-email 2.7.4 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Yogesh Lal Use STACK_HASH_ORDER_SHIFT to configure STACK_HASH_SIZE. Aim is to have configurable value for STACK_HASH_SIZE, so depend on use case one can configure it. One example is of Page Owner, default value of STACK_HASH_SIZE lead stack depot to consume 8MB of static memory. Making it configurable and use lower value helps to enable features like CONFIG_PAGE_OWNER without any significant overhead. Signed-off-by: Yogesh Lal Signed-off-by: Vinayak Menon Signed-off-by: Vijayanand Jitta --- lib/Kconfig | 9 +++++++++ lib/stackdepot.c | 3 +-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/Kconfig b/lib/Kconfig index 18d76b6..b3f8259 100644 --- a/lib/Kconfig +++ b/lib/Kconfig @@ -651,6 +651,15 @@ config STACKDEPOT bool select STACKTRACE +config STACK_HASH_ORDER_SHIFT + int "stack depot hash size (12 => 4KB, 20 => 1024KB)" + range 12 20 + default 20 + depends on STACKDEPOT + help + Select the hash size as a power of 2 for the stackdepot hash table. + Choose a lower value to reduce the memory impact. + config SBITMAP bool diff --git a/lib/stackdepot.c b/lib/stackdepot.c index 2caffc6..413c20b 100644 --- a/lib/stackdepot.c +++ b/lib/stackdepot.c @@ -142,8 +142,7 @@ static struct stack_record *depot_alloc_stack(unsigned long *entries, int size, return stack; } -#define STACK_HASH_ORDER 20 -#define STACK_HASH_SIZE (1L << STACK_HASH_ORDER) +#define STACK_HASH_SIZE (1L << CONFIG_STACK_HASH_ORDER_SHIFT) #define STACK_HASH_MASK (STACK_HASH_SIZE - 1) #define STACK_HASH_SEED 0x9747b28c -- QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation 2.7.4