Messages in this thread | | | Date | Mon, 20 Apr 2015 14:04:53 -0700 | Subject | Re: [PATCH 16/24] link_path_walk: kill the recursion | From | Linus Torvalds <> |
| |
On Mon, Apr 20, 2015 at 11:13 AM, Al Viro <viro@zeniv.linux.org.uk> wrote: > */ > static int link_path_walk(const char *name, struct nameidata *nd) > { > + struct saved { > + struct path link; > + void *cookie; > + const char *name; > + } stack[MAX_NESTED_LINKS], *last = stack + nd->depth - 1; > struct path next; > int err;
I was going to complain about this, and suggest that you move it to the nameidata, but I see that you did that later.
That said, you then introduce a stack-allocated "struct saved stack[]" in path_mountpoint[] instead, *and* nameidata is saved on stack, so this all ends up being very stack-intensive anyway.
I might have missed some patch here, but would it be possible to just allocate a single per-thread nameidata, and just leave it at that? Because allocating that thing on the stack when it contains what is now one kilobyte of array data is *not* acceptable.
Other than that, my quick scan through this looked fine. And maybe that quick scan missed where you already did that too.
Linus
| |