From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752495AbbDTVE4 (ORCPT ); Mon, 20 Apr 2015 17:04:56 -0400 Received: from mail-ie0-f179.google.com ([209.85.223.179]:36818 "EHLO mail-ie0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750872AbbDTVEy (ORCPT ); Mon, 20 Apr 2015 17:04:54 -0400 MIME-Version: 1.0 In-Reply-To: <1429553588-24764-16-git-send-email-viro@ZenIV.linux.org.uk> References: <20150420181222.GK889@ZenIV.linux.org.uk> <1429553588-24764-16-git-send-email-viro@ZenIV.linux.org.uk> Date: Mon, 20 Apr 2015 14:04:53 -0700 X-Google-Sender-Auth: zNWaYHz1U5JqBdxSoOozNwtZsa8 Message-ID: Subject: Re: [PATCH 16/24] link_path_walk: kill the recursion From: Linus Torvalds To: Al Viro Cc: Neil Brown , Linux Kernel Mailing List , linux-fsdevel Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Apr 20, 2015 at 11:13 AM, Al Viro 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