From: Vijayanand Jitta <vjitta@codeaurora.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: minchan@kernel.org, glider@google.com, dan.j.williams@intel.com,
broonie@kernel.org, mhiramat@kernel.org,
linux-kernel@vger.kernel.org, ylal@codeaurora.org,
vinmenon@codeaurora.org, Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [PATCH v4 1/2] lib: stackdepot: Add support to configure STACK_HASH_SIZE
Date: Tue, 5 Jan 2021 14:54:40 +0530 [thread overview]
Message-ID: <50635706-e3b0-20da-a053-facb1430b1d1@codeaurora.org> (raw)
In-Reply-To: <20210104151223.34f97a033e966c9cc89915cb@linux-foundation.org>
On 1/5/2021 4:42 AM, Andrew Morton wrote:
> On Wed, 30 Dec 2020 18:15:30 +0530 vjitta@codeaurora.org wrote:
>
>> 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.
>
> Questions regarding the stackdepot code.
>
> - stack_table_tmp[] is __initdata. So after initmem is released,
> that "consume 8MB of static memory" should no longer be true. But
> iirc, not all architectures actually release __initdata memory. Does
> your architecture do this?
>
Thanks for review comments, I wasn't aware that __initdata is
architecture dependent, I was assuming that __initdata always frees
memory and yes the architecture which i am using (arm64) does free
__inidata.
> - Stackdepot copies stack_table_tmp[] into vmalloced memory during
> initcalls. Why? Why not simply make stack_table_tmp[] no longer
> __initdata and use that memory for all time?
>
> Presumably because in the stack_depot_disable==true case, we
> release stack_table_tmp[] memory, don't vmalloc for a copy of it, and
> save a bunch of memory? If so, this assumes that the __initdata
> memory is freed.
>
Yes, that correct. assumption here is __initidata will free memory if
stack_depot_disable=true is set.
> - Why is that hash table so large? Is it appropriately sized?
>
I think the large size of hash table is justified since the users of
stack depot like kasan, page owner etc store a very large number of stacks.
> - SMP is up and running during init_stackdepot(), I think? If so, is
> that huge memcpy smp-safe? Can other CPUs be modifying
> stack_table_tmp[] while the memcpy is in flight?
>
>
>
Yes, parallel access could be possible. I will add a locking mechanism
inplace.
Thanks,
Vijay
--
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a
member of Code Aurora Forum, hosted by The Linux Foundation
next prev parent reply other threads:[~2021-01-05 9:25 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-30 12:45 vjitta
2020-12-30 12:45 ` [PATCH v4 2/2] lib: stackdepot: Add support to disable stack depot vjitta
2021-01-04 23:12 ` [PATCH v4 1/2] lib: stackdepot: Add support to configure STACK_HASH_SIZE Andrew Morton
2021-01-05 9:24 ` Vijayanand Jitta [this message]
2021-01-19 4:02 ` Vijayanand Jitta
2021-01-07 9:44 ` Alexander Potapenko
2021-01-18 11:14 ` Vijayanand Jitta
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=50635706-e3b0-20da-a053-facb1430b1d1@codeaurora.org \
--to=vjitta@codeaurora.org \
--cc=akpm@linux-foundation.org \
--cc=broonie@kernel.org \
--cc=dan.j.williams@intel.com \
--cc=glider@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mhiramat@kernel.org \
--cc=minchan@kernel.org \
--cc=tglx@linutronix.de \
--cc=vinmenon@codeaurora.org \
--cc=ylal@codeaurora.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome