From patchwork Wed Oct 19 06:40:07 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andi Kleen X-Patchwork-Id: 120561 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 07395B6F94 for ; Wed, 19 Oct 2011 17:40:38 +1100 (EST) Received: (qmail 5025 invoked by alias); 19 Oct 2011 06:40:32 -0000 Received: (qmail 4876 invoked by uid 22791); 19 Oct 2011 06:40:31 -0000 X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from one.firstfloor.org (HELO one.firstfloor.org) (213.235.205.2) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 19 Oct 2011 06:40:16 +0000 Received: by one.firstfloor.org (Postfix, from userid 503) id CD0BC1A98020; Wed, 19 Oct 2011 08:40:13 +0200 (CEST) From: Andi Kleen To: gcc-patches@gcc.gnu.org Cc: Andi Kleen Subject: [PATCH 1/2] Add missing page rounding of a page_entry Date: Wed, 19 Oct 2011 08:40:07 +0200 Message-Id: <1319006408-6012-1-git-send-email-andi@firstfloor.org> Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org From: Andi Kleen This one place in ggc forgot to round page_entry->bytes to the next page boundary, which lead to all the heuristics in freeing to check for continuous memory failing. Round here too, like all other allocators already do. The memory consumed should be the same for MMAP because the kernel would round anyways. It may slightly increase memory usage when malloc groups are used. This will also increase the hitrate on the free page list slightly. gcc/: 2011-10-18 Andi Kleen * ggc-page.c (alloc_pages): Always round up entry_size. --- gcc/ggc-page.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/gcc/ggc-page.c b/gcc/ggc-page.c index 2da99db..ba88e3f 100644 --- a/gcc/ggc-page.c +++ b/gcc/ggc-page.c @@ -736,6 +736,7 @@ alloc_page (unsigned order) entry_size = num_objects * OBJECT_SIZE (order); if (entry_size < G.pagesize) entry_size = G.pagesize; + entry_size = ROUND_UP (entry_size, G.pagesize); entry = NULL; page = NULL;