Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp14176778pxu; Mon, 4 Jan 2021 15:15:09 -0800 (PST) X-Google-Smtp-Source: ABdhPJzM78+3JUc7s8IqhnHnfiFO/MCRmPDXxeBSdC3G7lggkAEEemR9s//ry4H3YjLpX0Suu7P+ X-Received: by 2002:a05:6402:2066:: with SMTP id bd6mr72804388edb.211.1609802109781; Mon, 04 Jan 2021 15:15:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609802109; cv=none; d=google.com; s=arc-20160816; b=hxQ86Tm7Zs4tFyXpymRd5PLlGR4b7g3RPzy4nuJMMnRQvfyT9FpYOKOF7/S9AqZUWy /SbHCqu/ejRY6Razx5e5F1du+cl0mNobcFL+ZjO9rK3K4tOg1/cmvEx5bP6OEDA3WFIK 3syHJCbag3qbzp0AOorJRRtr0ZHNgzE/o+Ea2GaqVqPI9fQC5mmaSbQKOCyq7eBPfpMb l76sClzEFyy0rirEdmfhcWacE5+/R0w4aLCslXfikfHW63t9f7UVaoGBJpR9o5ZQwCE0 nc4okb1pfaxrY20jD+jedBfH7Q2X50yj/SpPJ32VMq1hsrZTR+2Iht0Nyeys4mO9XKK9 bVEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=3GSM6q/QDp/7DIrPcpWHOJWovcX9hSYvP6kciQGPlYI=; b=Km93w5kFMuRzdd92+tXeTCLMeCvj/Bc7aDkHuuCwrUcVn4szIL9AZaB0uDBYQ6nhNr XxziUlC3ST93tN7cBTZhS+0gbfh1wr93VFnpUrGd5dgWrIgoZdIU2vubkQo4FEwZHDXZ Q65py8yLnzSJPzpXGrrMALLbzpbUEKKNQrxvT8hZPqAZjNSUn+MeT7BPh4QREWM4+RPj CrI/eXlKEZvn7whyjFrpvLSOQKJxRBOqDBu6iPUjXHUFS1S4kZODIz1kTYlP6etd0CKS 4u7TW5BK1JdOoMN07F/6vsBWKbJGKBcmcpjDGyz9Ng2bpxOmb2ykXPZH15hvYc78YqNq /a9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=jPz8mtUO; 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 dc22si31509119ejb.568.2021.01.04.15.14.46; Mon, 04 Jan 2021 15:15:09 -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=@linux-foundation.org header.s=korg header.b=jPz8mtUO; 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 S1727695AbhADXNG (ORCPT + 99 others); Mon, 4 Jan 2021 18:13:06 -0500 Received: from mail.kernel.org ([198.145.29.99]:54298 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727034AbhADXNF (ORCPT ); Mon, 4 Jan 2021 18:13:05 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 2E571207BC; Mon, 4 Jan 2021 23:12:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1609801944; bh=4xw73rpmOn2Qfj9HGYOfgfQn8qxUL654PxIL6NQ0Cf0=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=jPz8mtUOm85S9cfTmYh4GyRuGL0788hMhQtK2AL2mG+RlRLBtqNhVdn9zQvsc+mID //R5yswLdwVqdC87YRCWHkbBr0FVj9HjVC8cwSIXe7QdRoog2BHh7KN0VuQna0ei05 8/nTHrvKWbBcEp6xz/NBAaqfG7VRgS3awhzCv0nI= Date: Mon, 4 Jan 2021 15:12:23 -0800 From: Andrew Morton To: vjitta@codeaurora.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 , Alexander Potapenko Subject: Re: [PATCH v4 1/2] lib: stackdepot: Add support to configure STACK_HASH_SIZE Message-Id: <20210104151223.34f97a033e966c9cc89915cb@linux-foundation.org> In-Reply-To: <1609332331-2456-1-git-send-email-vjitta@codeaurora.org> References: <1609332331-2456-1-git-send-email-vjitta@codeaurora.org> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.31; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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? - 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. - Why is that hash table so large? Is it appropriately sized? - 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?