[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.21.2006081329570.3136@hadrien>
Date: Mon, 8 Jun 2020 13:34:25 +0200 (CEST)
From: Julia Lawall <julia.lawall@...ia.fr>
To: Dan Carpenter <dan.carpenter@...cle.com>
cc: Joe Perches <joe@...ches.com>,
Christophe JAILLET <christophe.jaillet@...adoo.fr>,
rjw@...ysocki.net, pavel@....cz, len.brown@...el.com,
Dan Carpenter <error27@...il.com>, linux-pm@...r.kernel.org,
linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: Re: [PATCH] kernel: power: swap: mark a function as __init to save
some memory
On Mon, 8 Jun 2020, Dan Carpenter wrote:
> On Sun, May 31, 2020 at 03:11:27PM -0700, Joe Perches wrote:
> > (adding Dan Carpenter)
> >
> > On Sun, 2020-05-31 at 23:00 +0200, Christophe JAILLET wrote:
> > > 'swsusp_header_init()' is only called via 'core_initcall'.
> > > It can be marked as __init to save a few bytes of memory.
> >
> > Hey Dan
> >
> > smatch has a full function calling tree right?
> >
> > Can smatch find unmarked functions called only by __init
> > functions so those unmarked functions can be appropriately
> > marked with __init like the below?
> >
>
> It turns out it's complicated to do this in Smatch because Sparse
> ignores the section attribute. :/
I wrote a script at one point for this for Coccinelle, and sent some
patches. It requires some effort, because you want to run it over and
over - once function Y becomes init, some other functions might become
init as well. The iteration could be done automatically with Coccinelle,
but I didn't take that option, because it semed safer to check the results
along the way. A version of the script is attached.
julia
View attachment "useful_inits3.cocci" of type "text/plain" (2715 bytes)
Powered by blists - more mailing lists