diff mbox series

[v4,03/11] dev_vprintk_emit: Increase hdr size

Message ID 20200724171706.1550403-4-tasleson@redhat.com
State Not Applicable
Delegated to: David Miller
Headers show
Series Add persistent durable identifier to storage log messages | expand

Commit Message

Tony Asleson July 24, 2020, 5:16 p.m. UTC
With the addition of the device persistent id we have the possibility
of adding 154 more bytes to the hdr.  Thus if we assume the previous
size of 128 was sufficent we can simply add the 2 amounts and round
up.

Signed-off-by: Tony Asleson <tasleson@redhat.com>
---
 drivers/base/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Andy Shevchenko July 25, 2020, 10:05 a.m. UTC | #1
On Fri, Jul 24, 2020 at 8:19 PM Tony Asleson <tasleson@redhat.com> wrote:
>
> With the addition of the device persistent id we have the possibility
> of adding 154 more bytes to the hdr.  Thus if we assume the previous
> size of 128 was sufficent we can simply add the 2 amounts and round

sufficient

> up.

...

> -       char hdr[128];
> +       char hdr[288];

This is quite a drastic change for the stack.
Can you refactor to avoid this?
Tony Asleson Aug. 26, 2020, 6:26 p.m. UTC | #2
On 7/25/20 5:05 AM, Andy Shevchenko wrote:
> On Fri, Jul 24, 2020 at 8:19 PM Tony Asleson <tasleson@redhat.com> wrote:
> 
>> -       char hdr[128];
>> +       char hdr[288];
> 
> This is quite a drastic change for the stack.
> Can you refactor to avoid this?

The only thing I can think of is using a hash of the identifier instead
of the value itself.  This could drastically reduce the stack usage and
data stored in journal, but it makes it kind of clumsy for using.

Would placing this on the heap be acceptable?
diff mbox series

Patch

diff --git a/drivers/base/core.c b/drivers/base/core.c
index 964690572a89..c2439d12608d 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -3814,7 +3814,7 @@  create_syslog_header(const struct device *dev, char *hdr, size_t hdrlen)
 int dev_vprintk_emit(int level, const struct device *dev,
 		     const char *fmt, va_list args)
 {
-	char hdr[128];
+	char hdr[288];
 	size_t hdrlen;
 
 	hdrlen = create_syslog_header(dev, hdr, sizeof(hdr));