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=-10.0 required=3.0 tests=BAYES_00,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham 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 44E03C4742C for ; Tue, 3 Nov 2020 23:27:22 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id B9A44223AB for ; Tue, 3 Nov 2020 23:27:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B9A44223AB Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id C39056B005C; Tue, 3 Nov 2020 18:27:20 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id BC21E6B005D; Tue, 3 Nov 2020 18:27:20 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A60796B0068; Tue, 3 Nov 2020 18:27:20 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0084.hostedemail.com [216.40.44.84]) by kanga.kvack.org (Postfix) with ESMTP id 6FA796B005C for ; Tue, 3 Nov 2020 18:27:20 -0500 (EST) Received: from smtpin03.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 101FA181AC9C6 for ; Tue, 3 Nov 2020 23:27:20 +0000 (UTC) X-FDA: 77444695440.03.noise53_120cafb272bc Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin03.hostedemail.com (Postfix) with ESMTP id DF67E28A4E8 for ; Tue, 3 Nov 2020 23:27:19 +0000 (UTC) X-HE-Tag: noise53_120cafb272bc X-Filterd-Recvd-Size: 5014 Received: from mail-wm1-f67.google.com (mail-wm1-f67.google.com [209.85.128.67]) by imf41.hostedemail.com (Postfix) with ESMTP for ; Tue, 3 Nov 2020 23:27:19 +0000 (UTC) Received: by mail-wm1-f67.google.com with SMTP id 13so828572wmf.0 for ; Tue, 03 Nov 2020 15:27:19 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=nleQTGqvyY37bDvPtiFwPNAyFfPRKwZA1dXnS2tI+5Q=; b=ZlwgnrreQqarTvgetRUKzbRH+6QMw+jZGHo6pF9xE22PTo2IkZ+JGU2+D8uMHlWFz8 Wr+q5SEy4bUNbxTocEAsN0hyVoZ145NkHswNqEucKP0BV77FH4ppnx5qVSc1aZdCnjdN a6wp7w3fzrFNQcM5Lovae9kG9G1VP2pxQmBMIHCMu/BPg8fooSptpzHgqvaKWOJp6F7I wUVH+MDvc4kvXi33THbWb8Ha0fEO7Qz0ucrQtJ6mCWS418dQ9rp+L/QYX1UvcFAwvicE cpl0o12pcdZLV8aVuUhpDnnJD3YWckwxQ4QXQC675k/10JdzVOnEo4gr4jdsWNZgfIot cARg== X-Gm-Message-State: AOAM5331EpzYmm9KhqaqA7a2jx3G0jU6FIVPRHMnfnsegWmKAxLto+ec FLjRICpqqX9ErM0gr91rkbrVm6HvJC/DKFcEEgA= X-Google-Smtp-Source: ABdhPJyrn6W3/m3QdM+g6VA5EnAjyKatWc79M+cEsR4KLMUWeeXa8u6DAVD20RIIotwWRzHmvlQclaoYkPspnGtQWfU= X-Received: by 2002:a1c:b487:: with SMTP id d129mr1608687wmf.38.1604446038443; Tue, 03 Nov 2020 15:27:18 -0800 (PST) MIME-Version: 1.0 References: <1603372546-27118-1-git-send-email-vjitta@codeaurora.org> In-Reply-To: <1603372546-27118-1-git-send-email-vjitta@codeaurora.org> From: Minchan Kim Date: Tue, 3 Nov 2020 15:27:03 -0800 Message-ID: Subject: Re: [PATCH] lib: stackdepot: Add support to configure STACK_HASH_SIZE To: vjitta@codeaurora.org, 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 Content-Type: text/plain; charset="UTF-8" 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: 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. -- Kind regards, Minchan Kim