Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756764Ab3DQErW (ORCPT ); Wed, 17 Apr 2013 00:47:22 -0400 Received: from mail-pb0-f53.google.com ([209.85.160.53]:34908 "EHLO mail-pb0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753416Ab3DQErV (ORCPT ); Wed, 17 Apr 2013 00:47:21 -0400 Date: Tue, 16 Apr 2013 21:47:18 -0700 (PDT) From: David Rientjes X-X-Sender: rientjes@chino.kir.corp.google.com To: Yasuaki Ishimatsu cc: Andrew Morton , toshi.kani@hp.com, linuxram@us.ibm.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [Bug fix PATCH v3] Reusing a resource structure allocated by bootmem In-Reply-To: <516E2305.3060705@jp.fujitsu.com> Message-ID: References: <516DEC34.7040008@jp.fujitsu.com> <516E2305.3060705@jp.fujitsu.com> User-Agent: Alpine 2.02 (DEB 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1480 Lines: 30 On Wed, 17 Apr 2013, Yasuaki Ishimatsu wrote: > > Why not simply do what generic sparsemem support does by testing > > PageSlab(virt_to_head_page(res)) and calling kfree() if true and freeing > > back to bootmem if false? This should be like a five line patch. > > Is your explanation about free_section_usemap()? > If so, I don't think we can release resource structure like > free_section_usemap(). Right, you can't release it like free_section_usemap(), but you're free to test for PageSlab(virt_to_head_page(res)) in kernel/resource.c. > In your explanation case, memmap can be released by put_page_bootmem() in > free_map_bootmem() since all pages of memmap is used only for memmap. > But if my understanding is correct, a page of released resource structure > contain other purpose objects allocated by bootmem. So we cannot > release resource structure like free_section_usemap(). > I'm thinking it would be much easier to just suppress the kfree() if !PageSlab. If you can free an entire page with free_bootmem_late(), that would be great, but I'm thinking that will take more work than it's worth. It seems fine to just do free_bootmem() and leave those pages as reserved. How much memory are we talking about? -- 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/