From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932373AbcHIT6T (ORCPT ); Tue, 9 Aug 2016 15:58:19 -0400 Received: from mail-qk0-f195.google.com ([209.85.220.195]:33157 "EHLO mail-qk0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752429AbcHIT6R (ORCPT ); Tue, 9 Aug 2016 15:58:17 -0400 Date: Tue, 9 Aug 2016 15:58:13 -0400 From: Tejun Heo To: "Serge E. Hallyn" Cc: 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: <20160809195813.GF4906@mtj.duckdns.org> References: <1470720204-4605-1-git-send-email-tj@kernel.org> <1470720204-4605-3-git-send-email-tj@kernel.org> <20160809153305.GB30775@mail.hallyn.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160809153305.GB30775@mail.hallyn.com> User-Agent: Mutt/1.6.2 (2016-07-01) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.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. -- tejun