Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2516295pxb; Mon, 18 Jan 2021 21:55:38 -0800 (PST) X-Google-Smtp-Source: ABdhPJx12NWaof4IrUEOrvbOf7/Ba621Aqv5Lr+6l/GMBfQodyTvl4lWkHxfwQinIkYljX0BdHiv X-Received: by 2002:a17:906:eca7:: with SMTP id qh7mr1979558ejb.437.1611035738223; Mon, 18 Jan 2021 21:55:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611035738; cv=none; d=google.com; s=arc-20160816; b=fp1XDh37JvZWWoXPFOHwJ7EPVGdOzMKJ2SH1dG7XTvQD7UZnyRg6pwuprsfw02qo+9 +SCUftkiPxw9lrAdd7bvchj1WXFgZG9C8dxSrBlb+nZOpXSdoX3XuOjIu9oOz0kr0N5Q ZZiSOBr2iteONOND7ReQT6SXsnzYSSGXG32hkt1VIeL+YSaQBiuOdWjlOai1yH2H+UJq PodKbIrfJBKc5sPRNaudMF1j+/YpYVMRli3N9oq5V50z85h6vwT0YOjOsNNm1wpwHJxC EqtYiQWtJNCrgkTAesrZGDzvq5U3qUenZWnGG0ceEhO6TLVMRSYMFa+DnkJvl1eT2GF5 OBCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:references:cc :to:from:subject:dmarc-filter:sender:dkim-signature; bh=hqSaBJC25YzefV/w05jd1KbxgKk1Mst3ZpX3NfFPPZo=; b=HO/J+xFtmT/YjXf54aS1QQNHAn24kduAJMVvFlnbcQRVPSGMLEalecm7MP+6Wc9zVK srs4rXwy0k9fYVCJOWmMae/rVc2PLD5n9R9Vpvotfg/BFrh6UmNgrkgOCXpFsy/LUigI 0pHzaobLuIMnjF0mL3CHiE85cwwnN+y4P5giQlwCH04/qirBRLCHDK3i6FX1pOiAyhWp EnBdz6GUQorOrp24Vw8K3W/V9DzWej9xhuKGXOtG9wG+CAU909lLxRgU/1W+pToLRiZF Yh+YSkqg+tBvxR5f+vlB7VooDbZGo5Rg+YCBEMzewXGn819YiZtcO+JweSTQyTJZx6Ko tmIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=X37eaPAH; 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 gb19si6322413ejc.338.2021.01.18.21.55.01; Mon, 18 Jan 2021 21:55:38 -0800 (PST) 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=X37eaPAH; 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 S1730113AbhASEMB (ORCPT + 99 others); Mon, 18 Jan 2021 23:12:01 -0500 Received: from a1.mail.mailgun.net ([198.61.254.60]:40866 "EHLO a1.mail.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730216AbhASEJ2 (ORCPT ); Mon, 18 Jan 2021 23:09:28 -0500 X-Greylist: delayed 362 seconds by postgrey-1.27 at vger.kernel.org; Mon, 18 Jan 2021 23:09:28 EST DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1611029345; h=Content-Transfer-Encoding: Content-Type: In-Reply-To: MIME-Version: Date: Message-ID: References: Cc: To: From: Subject: Sender; bh=hqSaBJC25YzefV/w05jd1KbxgKk1Mst3ZpX3NfFPPZo=; b=X37eaPAH/Sb651mrGrOFvgbNfp+nVH/MzVWzmsgxKdzLXpH0FM1Nj0QQJYyBJPHs7DG7xHtb oW4WZ+uzfqpAptGM3wGZ0e3/8fLoj71MtfR0dhhzsxShWzzF7Gwue1IYNAm/+vrpSVsLedXk WpidGhjS+pVAonpeJ58GYj1jKI8= X-Mailgun-Sending-Ip: 198.61.254.60 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-n04.prod.us-east-1.postgun.com with SMTP id 600659dc1e3bf9b669a40135 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Tue, 19 Jan 2021 04:02:36 GMT Sender: vjitta=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 34EBBC43461; Tue, 19 Jan 2021 04:02:36 +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=-3.1 required=2.0 tests=ALL_TRUSTED,BAYES_00, NICE_REPLY_A,SPF_FAIL autolearn=no autolearn_force=no version=3.4.0 Received: from [192.168.0.106] (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 E53EAC433C6; Tue, 19 Jan 2021 04:02:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org E53EAC433C6 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 v4 1/2] lib: stackdepot: Add support to configure STACK_HASH_SIZE From: Vijayanand Jitta To: Andrew Morton 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 References: <1609332331-2456-1-git-send-email-vjitta@codeaurora.org> <20210104151223.34f97a033e966c9cc89915cb@linux-foundation.org> <50635706-e3b0-20da-a053-facb1430b1d1@codeaurora.org> Message-ID: Date: Tue, 19 Jan 2021 09:32:27 +0530 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.6.1 MIME-Version: 1.0 In-Reply-To: <50635706-e3b0-20da-a053-facb1430b1d1@codeaurora.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 1/5/2021 2:54 PM, Vijayanand Jitta wrote: > > > 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 > I have updated the patch avoiding __initdata as per suggestion and the copy from tmp , can you please review v5. https://lore.kernel.org/patchwork/patch/1367306/ Thanks, Vijay -- QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation