lkml.org 
[lkml]   [2008]   [Apr]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] vfs: reduce stack usage by shrinking struct kiocb
Denys Vlasenko wrote:
> Hi Al, Benjamin, David,
>
> struct kiocb is placed on stack by, for example, do_sync_write().
> Eventually it contributes to xfs writeout path's stack usage, among others.
> This is *the* path which causes 4k stack overflows on i386 with xfs.
>
> This patch trivially reorders fields of this structure,
> and makes some of them smaller.

Great, thanks for doing this. I see one fatal bug, though. Can you fix
it up and resubmit?

- unsigned long ki_flags;
+ unsigned short ki_flags; /* range: 0..2 */

Careful, ki_flags is used by the bitops routines which require an
unsigned long. I'd just leave ki_flags as is.

> ki_nr_segs: ulong -> uint: nobody uses 4 billion element writev's
> (and it would not work anyway)

Indeed. Maybe explicitly mention that it's safe 'cause we pass
ki_nbytes to rw_copy_check_uvector() for comparison against UIO_MAXIOV
before we store it in the kiocb.

+ /*unsigned short ki_opcode; - moved up for denser packing */

Don't bother commenting out fields that are moved, just move 'em.

Otherwise it looks great, thanks.

- z


\
 
 \ /
  Last update: 2008-04-28 18:15    [W:0.279 / U:0.060 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site