* is there an efficient module_is_builtin() test ?
@ 2021-03-09 19:55 jim.cromie
2021-03-09 22:25 ` Valdis Klētnieks
0 siblings, 1 reply; 3+ messages in thread
From: jim.cromie @ 2021-03-09 19:55 UTC (permalink / raw)
To: kernelnewbies
[-- Attachment #1.1: Type: text/plain, Size: 763 bytes --]
Im trying to reduce memory used by
internal tables built into DYNAMIC_DEBUG
the main savings available is in the per pr_debug*
callsite data: modname, filename, funcname.
I have segregated those fields to a new __dyndbg_sites section,
described by struct _ddebug_site, and now refd by new ptr in
struct _ddebug
That new ptr enlarges the memory footprint, so I want to replace it
with an integer index into the section / array. Existing padding could
hold the index.
To use the index, I need &dyndbg_sites[], and that only works
for builtin-module's callsites. For loaded modules, I can/have
added a pointer to the section into module load_info, giving me
the base I will need for the ! builtin branch.
I just need a not expensive is-it-builtin (modref)
[-- Attachment #1.2: Type: text/html, Size: 1039 bytes --]
[-- Attachment #2: Type: text/plain, Size: 170 bytes --]
_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: is there an efficient module_is_builtin() test ?
2021-03-09 19:55 is there an efficient module_is_builtin() test ? jim.cromie
@ 2021-03-09 22:25 ` Valdis Klētnieks
2021-03-17 4:59 ` jim.cromie
0 siblings, 1 reply; 3+ messages in thread
From: Valdis Klētnieks @ 2021-03-09 22:25 UTC (permalink / raw)
To: jim.cromie; +Cc: kernelnewbies
On Tue, 09 Mar 2021 12:55:14 -0700, jim.cromie@gmail.com said:
> To use the index, I need &dyndbg_sites[], and that only works
> for builtin-module's callsites. For loaded modules, I can/have
> added a pointer to the section into module load_info, giving me
> the base I will need for the ! builtin branch.
>
> I just need a not expensive is-it-builtin (modref)
One way to sidestep it is to stick in an EXPORT_SYMBOL(dyndbg_sites)
in the .c file you're defining it, and let the module loader do all the heavy
lifting for you. Not sure if some license purist would insist on EXPORT_SYMBOL_GPL
instead - the difference will only matter for out-of-tree non-GPL modules.
An slightly uglier solution is to do something like
#if defined(MODULE)
#define FIND_DEBUG /* code to find via load_info */
#else
#define FIND_DEBUG /* code to load &dyndbg_site directly */
#endif
which you should probably stick into a suitable .h file, and then
stick your newly defined FIND_DEBUG where you need the magic
happen (probably in a .h file as well)
_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: is there an efficient module_is_builtin() test ?
2021-03-09 22:25 ` Valdis Klētnieks
@ 2021-03-17 4:59 ` jim.cromie
0 siblings, 0 replies; 3+ messages in thread
From: jim.cromie @ 2021-03-17 4:59 UTC (permalink / raw)
To: Valdis Klētnieks; +Cc: kernelnewbies
[-- Attachment #1.1: Type: text/plain, Size: 686 bytes --]
On Tue, Mar 9, 2021 at 3:25 PM Valdis Klētnieks <valdis.kletnieks@vt.edu>
wrote:
> On Tue, 09 Mar 2021 12:55:14 -0700, jim.cromie@gmail.com said:
>
> > To use the index, I need &dyndbg_sites[], and that only works
> > for builtin-module's callsites. For loaded modules, I can/have
> > added a pointer to the section into module load_info, giving me
> > the base I will need for the ! builtin branch.
> >
> > I just need a not expensive is-it-builtin (modref)
>
thanks Valdis, the back and forth helped.
So, to follow up, the above is embodied here;
https://lore.kernel.org/lkml/20210316050801.2446401-1-jim.cromie@gmail.com/
in the add index patch, near 13/18
[-- Attachment #1.2: Type: text/html, Size: 1249 bytes --]
[-- Attachment #2: Type: text/plain, Size: 170 bytes --]
_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-03-17 4:59 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-09 19:55 is there an efficient module_is_builtin() test ? jim.cromie
2021-03-09 22:25 ` Valdis Klētnieks
2021-03-17 4:59 ` jim.cromie
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.