From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.1 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, NICE_REPLY_A,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 559D2C388F7 for ; Thu, 12 Nov 2020 12:56:58 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 9664A21D91 for ; Thu, 12 Nov 2020 12:56:57 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=mg.codeaurora.org header.i=@mg.codeaurora.org header.b="MELQTTR2" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9664A21D91 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id DD3096B005D; Thu, 12 Nov 2020 07:56:56 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D83916B0068; Thu, 12 Nov 2020 07:56:56 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C71386B006C; Thu, 12 Nov 2020 07:56:56 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0236.hostedemail.com [216.40.44.236]) by kanga.kvack.org (Postfix) with ESMTP id 9A0406B005D for ; Thu, 12 Nov 2020 07:56:56 -0500 (EST) Received: from smtpin02.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 393011EE6 for ; Thu, 12 Nov 2020 12:56:56 +0000 (UTC) X-FDA: 77475766032.02.key67_5b16d7227306 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin02.hostedemail.com (Postfix) with ESMTP id 1104310097AA0 for ; Thu, 12 Nov 2020 12:56:56 +0000 (UTC) X-HE-Tag: key67_5b16d7227306 X-Filterd-Recvd-Size: 6643 Received: from m42-4.mailgun.net (m42-4.mailgun.net [69.72.42.4]) by imf42.hostedemail.com (Postfix) with ESMTP for ; Thu, 12 Nov 2020 12:56:52 +0000 (UTC) DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1605185815; h=Content-Transfer-Encoding: Content-Type: In-Reply-To: MIME-Version: Date: Message-ID: References: Cc: To: From: Subject: Sender; bh=YGbiqQVX0zn5ulohah4Bb/Xz8yjVkbbJmLwpnFLalJE=; b=MELQTTR249XZCVDMc1tqJ6m+jXmk/EKj8aQhm7RJ6x/eB3V4dUNToWj1EL8O0EF6qw9CaRy7 2Rthu71xyUl0mszh2LBGUrCScp9CMbTRlbeqXpxZIm3ZIyYgHuABILFOPOHp7wnbGavNsJv7 GSITEuzxJjlAoy5Bkwf/41VU0NM= X-Mailgun-Sending-Ip: 69.72.42.4 X-Mailgun-Sid: WyIwY2Q3OCIsICJsaW51eC1tbUBrdmFjay5vcmciLCAiYmU5ZTRhIl0= Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n01.prod.us-west-2.postgun.com with SMTP id 5fad310b40d4446125c3bdd7 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Thu, 12 Nov 2020 12:56:43 GMT Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 8514BC433CB; Thu, 12 Nov 2020 12:56:43 +0000 (UTC) Received: from [192.168.0.104] (unknown [182.18.191.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: vjitta) by smtp.codeaurora.org (Postfix) with ESMTPSA id 81A28C433C8; Thu, 12 Nov 2020 12:56:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 81A28C433C8 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 Subject: Re: [PATCH] lib: stackdepot: Add support to configure STACK_HASH_SIZE From: Vijayanand Jitta To: Minchan Kim , linux-mm Cc: glider@google.com, Dan Williams , broonie@kernel.org, mhiramat@kernel.org, "linux-kernel@vger.kernel.org" , Andrew Morton , Yogesh Lal , Vinayak Menon References: <1603372546-27118-1-git-send-email-vjitta@codeaurora.org> <282d7028-498d-50b3-37d4-2381571f9f9e@codeaurora.org> Message-ID: Date: Thu, 12 Nov 2020 18:26:24 +0530 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.4.1 MIME-Version: 1.0 In-Reply-To: <282d7028-498d-50b3-37d4-2381571f9f9e@codeaurora.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 7bit X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 11/4/2020 3:59 PM, Vijayanand Jitta wrote: > > > On 11/4/2020 4:57 AM, Minchan Kim wrote: >> Sorry if this mail corrupts the mail thread or had heavy mangling >> since I lost this mail from my mailbox so I am sending this mail by >> web gmail. >> >> On Thu, Oct 22, 2020 at 10:18 AM wrote: >>> >>> 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 >>> >> >> 1. When we don't use page_owner, we don't want to waste any memory for >> stackdepot hash array. >> 2. When we use page_owner, we want to have reasonable stackdeport hash array >> >> With this configuration, it couldn't meet since we always need to >> reserve a reasonable size for the array. >> Can't we make the hash size as a kernel parameter? >> With it, we could use it like this. >> >> 1. page_owner=off, stackdepot_stack_hash=0 -> no more wasted memory >> when we don't use page_owner >> 2. page_owner=on, stackdepot_stack_hash=8M -> reasonable hash size >> when we use page_owner. >> >> > > This idea looks fine to me. Andrew and others would like to hear your > comments as well on this before implementing. > > Thanks, > Vijay > Awaiting for comments from Andrew and others. Thanks, Vijay -- QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation