lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20110520223032.GA15192@x61.tchesoft.com>
Date:	Fri, 20 May 2011 19:30:34 -0300
From:	Rafael Aquini <aquini@...ux.com>
To:	Andrew Morton <akpm@...ux-foundation.org>
Cc:	Russ Anderson <rja@....com>,
	Andrea Arcangeli <aarcange@...hat.com>,
	linux-mm <linux-mm@...ck.org>,
	linux-kernel <linux-kernel@...r.kernel.org>,
	Christoph Lameter <cl@...ux.com>
Subject: Re: [PATCH] [BUGFIX] mm: hugepages can cause negative commitlimit

On Fri, May 20, 2011 at 01:04:11PM -0700, Andrew Morton wrote:
> On Thu, 19 May 2011 17:11:01 -0500
> Russ Anderson <rja@....com> wrote:
> 
> > OK, I see your point.  The root problem is hugepages allocated at boot are
> > subtracted from totalram_pages but hugepages allocated at run time are not.
> > Correct me if I've mistate it or are other conditions.
> > 
> > By "allocated at run time" I mean "echo 1 > /proc/sys/vm/nr_hugepages".
> > That allocation will not change totalram_pages but will change
> > hugetlb_total_pages().
> > 
> > How best to fix this inconsistency?  Should totalram_pages include or exclude
> > hugepages?  What are the implications?
> 
> The problem is that hugetlb_total_pages() is trying to account for two
> different things, while totalram_pages accounts for only one of those
> things, yes?
> 
> One fix would be to stop accounting for huge pages in totalram_pages
> altogether.  That might break other things so careful checking would be
> needed.
> 
> Or we stop accounting for the boot-time allocated huge pages in
> hugetlb_total_pages().  Split the two things apart altogether and
> account for boot-time allocated and runtime-allocated pages separately.  This
> souds saner to me - it reflects what's actually happening in the kernel.

Perhaps we can just reinstate the # of pages "stealed" at early boot allocation
later, when hugetlb_init() calls gather_bootmem_prealloc()

diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 8ee3bd8..d606c9c 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -1111,6 +1111,7 @@ static void __init gather_bootmem_prealloc(void)
                WARN_ON(page_count(page) != 1);
                prep_compound_huge_page(page, h->order);
                prep_new_huge_page(h, page, page_to_nid(page));
+               totalram_pages += 1 << h->order;
        }
 }

-- 
Rafael Aquini <aquini@...ux.com>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ