From patchwork Fri Jun 20 17:37:14 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Salter X-Patchwork-Id: 32289 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vc0-f198.google.com (mail-vc0-f198.google.com [209.85.220.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 76962203F4 for ; Fri, 20 Jun 2014 17:37:56 +0000 (UTC) Received: by mail-vc0-f198.google.com with SMTP id hy10sf12139906vcb.9 for ; Fri, 20 Jun 2014 10:37:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:message-id:subject:from:to:cc:date :in-reply-to:references:organization:mime-version:sender:precedence :list-id:x-original-sender:x-original-authentication-results :mailing-list:list-post:list-help:list-archive:list-unsubscribe :content-type:content-transfer-encoding; bh=GHLtIaHc9ccl2CFwFLmmfSZoFVSZlfIXGq/j1qQxF+U=; b=RJ7MtHASQAUnlWiKZLo1i7VfpXSBFLaSCQshykeAf8BnrYu+/DKPYagW21UoIptiJz h2WwxRco4yAy0d+F5hSd8EUpxGRwmTD7idCF9RPd0mi4pHB7raNKxLvm3YGEtTwk8Ahw oonAc8MtLWs6eCJDyUzKGDnVtdM59sTV1pwEI93xa9uNyb3SrY+a7fTrRhdCm7kVcvQC LAqw3VAM/bkNJ81Ow+kxUtLiuShqoyboVxE+G6IsAg8v3tPiXNwOXJPEAZ/ITC+E6KuZ LfGfsVU5OQQzIG5cXIo0Fk19bCZEQ4j8BGe3bLt5J++7M7p+1MtP12aWZUnljP0Im42l g3Ww== X-Gm-Message-State: ALoCoQk6CY0PPS/rH6sK92HRMna3LS9CG1BBjeZ2LVl/oP1gEhKjuDi+SAaMRE1eR9Blp2Y5WkJC X-Received: by 10.236.202.143 with SMTP id d15mr1666982yho.18.1403285876169; Fri, 20 Jun 2014 10:37:56 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.19.70 with SMTP id 64ls1100258qgg.19.gmail; Fri, 20 Jun 2014 10:37:56 -0700 (PDT) X-Received: by 10.58.227.193 with SMTP id sc1mr2420465vec.43.1403285876095; Fri, 20 Jun 2014 10:37:56 -0700 (PDT) Received: from mail-ve0-f174.google.com (mail-ve0-f174.google.com [209.85.128.174]) by mx.google.com with ESMTPS id uw7si4500574vec.24.2014.06.20.10.37.55 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 20 Jun 2014 10:37:55 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.174 as permitted sender) client-ip=209.85.128.174; Received: by mail-ve0-f174.google.com with SMTP id jx11so3880670veb.33 for ; Fri, 20 Jun 2014 10:37:55 -0700 (PDT) X-Received: by 10.58.72.165 with SMTP id e5mr1787160vev.59.1403285875774; Fri, 20 Jun 2014 10:37:55 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.37.5 with SMTP id tc5csp39483vcb; Fri, 20 Jun 2014 10:37:55 -0700 (PDT) X-Received: by 10.66.136.103 with SMTP id pz7mr6720770pab.140.1403285874749; Fri, 20 Jun 2014 10:37:54 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id au10si10656178pbd.14.2014.06.20.10.37.53; Fri, 20 Jun 2014 10:37:53 -0700 (PDT) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935245AbaFTRhv (ORCPT + 12 others); Fri, 20 Jun 2014 13:37:51 -0400 Received: from mx1.redhat.com ([209.132.183.28]:29017 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934970AbaFTRhu (ORCPT ); Fri, 20 Jun 2014 13:37:50 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s5KHbF8L026039 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 20 Jun 2014 13:37:15 -0400 Received: from [10.3.113.76] (ovpn-113-76.phx2.redhat.com [10.3.113.76]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s5KHbEKF029624; Fri, 20 Jun 2014 13:37:14 -0400 Message-ID: <1403285834.755.39.camel@deneb.redhat.com> Subject: Re: [PATCH] arm64: fix MAX_ORDER for 64K pagesize From: Mark Salter To: Michal Nazarewicz Cc: David Rientjes , Marek Szyprowski , Catalin Marinas , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Date: Fri, 20 Jun 2014 13:37:14 -0400 In-Reply-To: References: <1402522435-13884-1-git-send-email-msalter@redhat.com> <1403201524.32688.62.camel@deneb.redhat.com> Organization: Red Hat, Inc Mime-Version: 1.0 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: msalter@redhat.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.128.174 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , On Thu, 2014-06-19 at 21:24 +0200, Michal Nazarewicz wrote: > On Thu, Jun 19 2014, Mark Salter wrote: > > On Tue, 2014-06-17 at 20:32 +0200, Michal Nazarewicz wrote: > >> diff --git a/mm/page_alloc.c b/mm/page_alloc.c > >> index 5dba293..6e657ce 100644 > >> --- a/mm/page_alloc.c > >> +++ b/mm/page_alloc.c > >> @@ -801,7 +801,15 @@ void __init init_cma_reserved_pageblock(struct page *page) > >> > >> set_page_refcounted(page); > >> set_pageblock_migratetype(page, MIGRATE_CMA); > >> - __free_pages(page, pageblock_order); > >> + if (pageblock_order > MAX_ORDER) { > >> + struct page *subpage = p; > >> + unsigned count = 1 << (pageblock_order - MAX_ORDER); > >> + do { > >> + __free_pages(subpage, pageblock_order); > > ^^^^^^^ > > MAX_ORDER > > D'oh! I'll send a revised patch. > > >> + } while (subpage += MAX_ORDER_NR_PAGES, --count); > >> + } else { > >> + __free_pages(page, pageblock_order); > >> + } > >> adjust_managed_page_count(page, pageblock_nr_pages); > >> } > >> #endif > >> --------- >8 --------------------------------------------------------- > >> > >> Thoughts? This has not been tested and I think it may cause performance > >> degradation in some cases since pageblock_order is not always > >> a constant, so the comparison may end up not being stripped away even on > >> systems where it's always false. > > > This works with the above tweak. So it fixes the problm here, but I was > > not sure if we'd get bitten elsewhere by pageblock_order > MAX_ORDER. > > This is always a possibility, but in such cases, it's a bug in CMA. > I've tried to keep in mind that pageblock_order may be greater than > MAX_ORDER when writing CMA, but I've never tested on such a system. > > > It will be slower, but does it only gets called a few time at most at > > boot time, right? > > Yes. The performance degradation should be negligible since > init_cma_reserved is hardly a critical path and is called at most > MAX_CMA_AREAS times which by default is 8. And I mean it will be slower > because it will have to perform a branch. > I ended up needing this (on top of your patch) to get the system to boot. Each MAX_ORDER-1 group needs the refcount and migratetype set so that __free_pages does the right thing. --- 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/ diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 02fb1ed..a7ca6cc 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -799,17 +799,18 @@ void __init init_cma_reserved_pageblock(struct page *page) set_page_count(p, 0); } while (++p, --i); - set_page_refcounted(page); - set_pageblock_migratetype(page, MIGRATE_CMA); - - if (pageblock_order > MAX_ORDER) { - i = pageblock_order - MAX_ORDER; + if (pageblock_order >= MAX_ORDER) { + i = pageblock_order - MAX_ORDER + 1; i = 1 << i; p = page; do { - __free_pages(p, MAX_ORDER); + set_page_refcounted(p); + set_pageblock_migratetype(p, MIGRATE_CMA); + __free_pages(p, MAX_ORDER - 1); } while (p += MAX_ORDER_NR_PAGES, --i); } else { + set_page_refcounted(page); + set_pageblock_migratetype(page, MIGRATE_CMA); __free_pages(page, pageblock_order); }