Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932295AbdGSUuT (ORCPT ); Wed, 19 Jul 2017 16:50:19 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:43850 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756058AbdGSUuR (ORCPT ); Wed, 19 Jul 2017 16:50:17 -0400 Date: Wed, 19 Jul 2017 13:50:14 -0700 From: Andrew Morton To: Zhaoyang Huang Cc: zhaoyang.huang@spreadtrum.com, Michal Hocko , Ingo Molnar , zijun_hu , Vlastimil Babka , Thomas Garnier , "Kirill A. Shutemov" , Andrey Ryabinin , linux-mm@kvack.org, linux-kernel@vger.kernel.org, zijun_hu@zoho.com Subject: Re: [PATCH] mm/vmalloc: add vm_struct for vm_map_ram area Message-Id: <20170719135014.fdc882d1e28fd130104eff5d@linux-foundation.org> In-Reply-To: <1500461043-7414-1-git-send-email-zhaoyang.huang@spreadtrum.com> References: <1500461043-7414-1-git-send-email-zhaoyang.huang@spreadtrum.com> X-Mailer: Sylpheed 3.4.1 (GTK+ 2.24.23; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1128 Lines: 32 On Wed, 19 Jul 2017 18:44:03 +0800 Zhaoyang Huang wrote: > /proc/vmallocinfo will not show the area allocated by vm_map_ram, which > will make confusion when debug. Add vm_struct for them and show them in > proc. > Please provide sample /proc/vmallocinfo so we can better understand the proposal. Is there a means by which people can determine that a particular area is from vm_map_ram()? I don't think so. Should there be? > > ... > > @@ -1173,6 +1178,12 @@ void *vm_map_ram(struct page **pages, unsigned int count, int node, pgprot_t pro > addr = (unsigned long)mem; > } else { > struct vmap_area *va; > + struct vm_struct *area; > + > + area = kzalloc_node(sizeof(*area), GFP_KERNEL, node); > + if (unlikely(!area)) > + return NULL; Allocating a vm_struct for each vm_map_ram area is a cost. And we're doing this purely for /proc/vmallocinfo. I think I'll need more persuading to convince me that this is a good tradeoff, given that *every* user will incur this cost, and approximately 0% of them will ever use /proc/vmallocinfo. So... do we *really* need this? If so, why?