Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935849Ab3DID7N (ORCPT ); Mon, 8 Apr 2013 23:59:13 -0400 Received: from mail-pa0-f53.google.com ([209.85.220.53]:35568 "EHLO mail-pa0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1763113Ab3DID7M (ORCPT ); Mon, 8 Apr 2013 23:59:12 -0400 Date: Mon, 8 Apr 2013 20:59:07 -0700 From: Tejun Heo To: Li Zefan Cc: Kamezawa Hiroyuki , Andrew Morton , Glauber Costa , Johannes Weiner , LKML , Cgroups , linux-mm@kvack.org Subject: Re: [PATCH 13/12] memcg: don't need memcg->memcg_name Message-ID: <20130409035907.GA4565@mtj.dyndns.org> References: <5162648B.9070802@huawei.com> <51626584.7050405@huawei.com> <5163868B.3020905@jp.fujitsu.com> <5163887D.1040809@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5163887D.1040809@huawei.com> 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 Content-Length: 1043 Lines: 28 On Tue, Apr 09, 2013 at 11:18:21AM +0800, Li Zefan wrote: > >> - if (memcg->memcg_name) > >> - seq_printf(m, "%s:\n", memcg->memcg_name); > >> + ret = cgroup_path(memcg->css.cgroup, memcg_name, PAGE_SIZE); > >> + if (!ret) > >> + seq_printf(m, "%s:\n", memcg_name); > >> else > >> seq_printf(m, "%p (name lost):\n", memcg); > >> > > > > I'm sorry for dawm question ...when this error happens ? > > We may get ENAMETOOLONG even with PAGE_SIZE(>=4096bytes) buffer ? > > > > It does no harm to check the return value, and we don't have to > worry about if cgroup_path() will be changed to return some other > errno like ENOMEM in the future. Maybe change the function to return the length of the path regardless of the specified buffer length? ie. as in snprintf()? -- tejun -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/