From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 491FF2F84F for ; Tue, 10 Mar 2026 20:17:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773173848; cv=none; b=UHyZcbr6qKL1Acdf2ZpZU0IA1QypGYl71f4HSpZembiahnymxaBCRY3HwO31IYtPF1odoRBbs9VB8TR1CdMr4CUeH5UUPfvOkOf7/6UbgCkCSbdMPkJf65rAnHngOg0ywLRd2gQ2e0L76rkuv9O2FYWT33bLCClor8BsYAYG+1g= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773173848; c=relaxed/simple; bh=QtKk1KetqJO8ddHn1s9ALjjzXPP0GPXnKoMmCBuF10k=; h=Date:From:To:Cc:Subject:Message-Id:In-Reply-To:References: Mime-Version:Content-Type; b=tcbKzaDqT2ZDWMdVjp43R7u31IAEbKid89/4jM5tWgDyTP0HgE6bi7i0pqtvqFH5eLqA+MtXMrEDBy1bDSaDwM+tEzqDgRmUO96ZyhtT0DYb8/B+FRapOM4j+F6Lw/cYcpb5YscFDvTQyLnvRVMXroIhl96VKtEHQtl0Fd3sv4I= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b=tqk+8Hgu; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="tqk+8Hgu" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 58FF5C19423; Tue, 10 Mar 2026 20:17:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1773173848; bh=QtKk1KetqJO8ddHn1s9ALjjzXPP0GPXnKoMmCBuF10k=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=tqk+8Hgu98kpdzc28GiDmYORtbSKwp9lglW3A6TiZzJJBSnLGGhi1BL33H+05JaeG zitw78dZuBZSOun8kLU3sldmNF843SsegUIH2z4IV9WDiyGpUTxbN+lx43DfW6wBbq YbcmSlPCsBgHtCjjJ/X4PdGrCh6YPqLLqSMfWdik= Date: Tue, 10 Mar 2026 13:17:26 -0700 From: Andrew Morton To: Barry Song <21cnbao@gmail.com> Cc: Breno Leitao , David Hildenbrand , Lorenzo Stoakes , Zi Yan , Baolin Wang , "Liam R. Howlett" , Nico Pache , Ryan Roberts , Dev Jain , Lance Yang , Vlastimil Babka , Suren Baghdasaryan , Michal Hocko , Brendan Jackman , Johannes Weiner , Mike Rapoport , linux-mm@kvack.org, linux-kernel@vger.kernel.org, usamaarif642@gmail.com, kas@kernel.org, kernel-team@meta.com, "Lorenzo Stoakes (Oracle)" Subject: Re: [PATCH v5 2/4] mm: huge_memory: refactor anon_enabled_store() with change_anon_orders() Message-Id: <20260310131726.a9173c7cfa333b6522f9c8f2@linux-foundation.org> In-Reply-To: References: <20260310-thp_logs-v5-0-686099175bf6@debian.org> <20260310-thp_logs-v5-2-686099175bf6@debian.org> X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Wed, 11 Mar 2026 04:11:36 +0800 Barry Song <21cnbao@gmail.com> wrote: > > +static bool set_anon_enabled_mode(int order, enum anon_enabled_mode mode) > > +{ > > + static unsigned long *enabled_orders[] = { > > + &huge_anon_orders_always, > > + &huge_anon_orders_madvise, > > + &huge_anon_orders_inherit, > > + }; > > Is there a reason enabled_orders needs to be static? > Could it instead be allocated on the stack? Could, but then the array would be rebuilt each time the function is called. The idea here is to save a bit of runtime cost.