From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752557AbcHIUOp (ORCPT ); Tue, 9 Aug 2016 16:14:45 -0400 Received: from h2.hallyn.com ([78.46.35.8]:50950 "EHLO h2.hallyn.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752184AbcHIUOn (ORCPT ); Tue, 9 Aug 2016 16:14:43 -0400 Date: Tue, 9 Aug 2016 15:14:41 -0500 From: "Serge E. Hallyn" To: Tejun Heo Cc: "Serge E. Hallyn" , gregkh@linuxfoundation.org, serge.hallyn@ubuntu.com, linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, kernel-team@fb.com, hannes@cmpxchg.org, lizefan@huawei.com Subject: Re: [PATCH 2/4] kernfs: make kernfs_path*() behave in the style of strlcpy() Message-ID: <20160809201441.GA2513@mail.hallyn.com> References: <1470720204-4605-1-git-send-email-tj@kernel.org> <1470720204-4605-3-git-send-email-tj@kernel.org> <20160809153305.GB30775@mail.hallyn.com> <20160809195813.GF4906@mtj.duckdns.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160809195813.GF4906@mtj.duckdns.org> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Quoting Tejun Heo (tj@kernel.org): > Hello, Serge. > > On Tue, Aug 09, 2016 at 10:33:05AM -0500, Serge E. Hallyn wrote: > > > + for (i = depth_to - 1; i >= 0; i--) { > > > + for (kn = kn_to, j = 0; j < i; j++) > > > + kn = kn->parent; > > > > This is O(n^2) where n is the path depth. It's not a hot path, though, do > > we care? > > I don't think it matters. It's a slow path and cgroup hierarchies > aren't supposed to be super deep to begin with. If it ever does, we > can replace the cgroup->ancestor_ids[] array with ancestor pointer > array and walk that instead. > > Thanks. Ok, thanks Acked-by: Serge Hallyn