* [PATCH] nubus: Avoid scanning "private" card resources
@ 2023-03-22 0:54 Finn Thain
2023-03-22 6:52 ` Finn Thain
0 siblings, 1 reply; 2+ messages in thread
From: Finn Thain @ 2023-03-22 0:54 UTC (permalink / raw)
To: Geert Uytterhoeven; +Cc: linux-m68k, linux-kernel
Some Nubus cards have many ROM resources. A single Radius video card
produced well over a thousand entries under /proc/bus/nubus. Populating
/proc/bus/nubus on a slow machine with several such cards installed takes
long enough that the user may think that the system is wedged. All those
procfs entries also consume significant RAM though they are not normally
needed except by developers. Omit the "private" resources from
/proc/bus/nubus/ by default and add a kernel parameter to enable them
when needed. On the test machine, this saved 196 KiB and 5 seconds.
Tested-by: Stan Johnson <userm57@yahoo.com>
Signed-off-by: Finn Thain <fthain@linux-m68k.org>
---
drivers/nubus/nubus.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/nubus/nubus.c b/drivers/nubus/nubus.c
index f70ba58dbc55..777099b8e818 100644
--- a/drivers/nubus/nubus.c
+++ b/drivers/nubus/nubus.c
@@ -34,6 +34,9 @@
LIST_HEAD(nubus_func_rsrcs);
+bool all_func_rsrcs;
+module_param(all_func_rsrcs, bool, 0444);
+
/* Meaning of "bytelanes":
The card ROM may appear on any or all bytes of each long word in
@@ -572,9 +575,9 @@ nubus_get_functional_resource(struct nubus_board *board, int slot,
nubus_proc_add_rsrc(dir.procdir, &ent);
break;
default:
- /* Local/Private resources have their own
- function */
- nubus_get_private_resource(fres, dir.procdir, &ent);
+ if (all_func_rsrcs)
+ nubus_get_private_resource(fres, dir.procdir,
+ &ent);
}
}
--
2.37.5
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] nubus: Avoid scanning "private" card resources
2023-03-22 0:54 [PATCH] nubus: Avoid scanning "private" card resources Finn Thain
@ 2023-03-22 6:52 ` Finn Thain
0 siblings, 0 replies; 2+ messages in thread
From: Finn Thain @ 2023-03-22 6:52 UTC (permalink / raw)
To: Geert Uytterhoeven; +Cc: linux-m68k, linux-kernel
On Wed, 22 Mar 2023, Finn Thain wrote:
> Some Nubus cards have many ROM resources. A single Radius video card
> produced well over a thousand entries under /proc/bus/nubus. Populating
> /proc/bus/nubus on a slow machine with several such cards installed takes
> long enough that the user may think that the system is wedged. All those
> procfs entries also consume significant RAM though they are not normally
> needed except by developers. Omit the "private" resources from
> /proc/bus/nubus/ by default and add a kernel parameter to enable them
> when needed. On the test machine, this saved 196 KiB and 5 seconds.
>
This patch is nice and short but I suspect it can be improved upon. If the
procfs entries are only needed for debugging then I should probably omit
all of them by default, and save even more time and RAM. So I think I'll
revise this patch.
> Tested-by: Stan Johnson <userm57@yahoo.com>
> Signed-off-by: Finn Thain <fthain@linux-m68k.org>
> ---
> drivers/nubus/nubus.c | 9 ++++++---
> 1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/nubus/nubus.c b/drivers/nubus/nubus.c
> index f70ba58dbc55..777099b8e818 100644
> --- a/drivers/nubus/nubus.c
> +++ b/drivers/nubus/nubus.c
> @@ -34,6 +34,9 @@
>
> LIST_HEAD(nubus_func_rsrcs);
>
> +bool all_func_rsrcs;
> +module_param(all_func_rsrcs, bool, 0444);
> +
> /* Meaning of "bytelanes":
>
> The card ROM may appear on any or all bytes of each long word in
> @@ -572,9 +575,9 @@ nubus_get_functional_resource(struct nubus_board *board, int slot,
> nubus_proc_add_rsrc(dir.procdir, &ent);
> break;
> default:
> - /* Local/Private resources have their own
> - function */
> - nubus_get_private_resource(fres, dir.procdir, &ent);
> + if (all_func_rsrcs)
> + nubus_get_private_resource(fres, dir.procdir,
> + &ent);
> }
> }
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-03-22 6:50 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-22 0:54 [PATCH] nubus: Avoid scanning "private" card resources Finn Thain
2023-03-22 6:52 ` Finn Thain
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®