From patchwork Mon Mar 10 12:41:46 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 25965 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pa0-f69.google.com (mail-pa0-f69.google.com [209.85.220.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 1B7502055F for ; Mon, 10 Mar 2014 12:43:35 +0000 (UTC) Received: by mail-pa0-f69.google.com with SMTP id fb1sf18578952pad.0 for ; Mon, 10 Mar 2014 05:43:35 -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:from:to:date:message-id:cc:subject :precedence:list-id:list-unsubscribe:list-post:list-help :list-subscribe:mime-version:sender:errors-to:x-original-sender :x-original-authentication-results:mailing-list:list-archive :content-type:content-transfer-encoding; bh=XDyXj4WjieWxuEK7dTPGHe7FhrkyJ5O8W/fl/jHMH1o=; b=Pfxf35qDG/NhrJEx7H5iC0NtqNYfVPpN1WguOR5xBfA3GCoiM791R5TVPSprMeFdNR EcCPV71QDmyp1CsQOjwA9sWwbopbM+wy/J5PQuvCm5ZMwp2NmuR9i5tyhtuPLRy3mjgG QJXvMMmbgZx4FVZsgU6rrGF1G6F+KWVKZLWLdt7lrzksbilbby9ppWfxuWzRfDT58FR8 kkCVCDJisMlTcSX7cuhufXX9b/dpheM+Y6/ejw6feZpi3QHEqUth3sTCV9PGvzPsayen XgbzaX+2ht4kQFZYnT1vMe63dM64qJfLrvyjnHTJtWiS20PLVdZJqAc+GwQswdSW6+rz 99Dw== X-Gm-Message-State: ALoCoQnVF3Ad115qWlmqibenVyH22BBsS0uCoHu0fjWLCjRRi0d9uyt5I9CCWoeiRE3cn80FwaVr X-Received: by 10.66.241.8 with SMTP id we8mr15779173pac.16.1394455413770; Mon, 10 Mar 2014 05:43:33 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.109.9 with SMTP id k9ls2106995qgf.78.gmail; Mon, 10 Mar 2014 05:43:33 -0700 (PDT) X-Received: by 10.58.190.99 with SMTP id gp3mr138352vec.32.1394455413655; Mon, 10 Mar 2014 05:43:33 -0700 (PDT) Received: from mail-ve0-f173.google.com (mail-ve0-f173.google.com [209.85.128.173]) by mx.google.com with ESMTPS id nc1si4681473vec.24.2014.03.10.05.43.33 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 10 Mar 2014 05:43:33 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.173 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.173; Received: by mail-ve0-f173.google.com with SMTP id oy12so7049553veb.32 for ; Mon, 10 Mar 2014 05:43:33 -0700 (PDT) X-Received: by 10.58.161.227 with SMTP id xv3mr155987veb.31.1394455413584; Mon, 10 Mar 2014 05:43:33 -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.220.78.9 with SMTP id i9csp115937vck; Mon, 10 Mar 2014 05:43:33 -0700 (PDT) X-Received: by 10.50.119.132 with SMTP id ku4mr17170466igb.35.1394455412889; Mon, 10 Mar 2014 05:43:32 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id q7si31199917igh.19.2014.03.10.05.43.32 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 10 Mar 2014 05:43:32 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of xen-devel-bounces@lists.xen.org designates 50.57.142.19 as permitted sender) client-ip=50.57.142.19; Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WMzWj-0004VD-Gx; Mon, 10 Mar 2014 12:41:53 +0000 Received: from mail6.bemta4.messagelabs.com ([85.158.143.247]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WMzWh-0004V5-U1 for xen-devel@lists.xenproject.org; Mon, 10 Mar 2014 12:41:52 +0000 Received: from [85.158.143.35:46290] by server-1.bemta-4.messagelabs.com id 10/F7-09853-F03BD135; Mon, 10 Mar 2014 12:41:51 +0000 X-Env-Sender: julien.grall@linaro.org X-Msg-Ref: server-13.tower-21.messagelabs.com!1394455310!917702!1 X-Originating-IP: [74.125.82.177] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 6.11.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 17813 invoked from network); 10 Mar 2014 12:41:50 -0000 Received: from mail-we0-f177.google.com (HELO mail-we0-f177.google.com) (74.125.82.177) by server-13.tower-21.messagelabs.com with RC4-SHA encrypted SMTP; 10 Mar 2014 12:41:50 -0000 Received: by mail-we0-f177.google.com with SMTP id u57so8276704wes.8 for ; Mon, 10 Mar 2014 05:41:50 -0700 (PDT) X-Received: by 10.180.13.33 with SMTP id e1mr8841566wic.38.1394455310307; Mon, 10 Mar 2014 05:41:50 -0700 (PDT) Received: from belegaer.uk.xensource.com. ([185.25.64.249]) by mx.google.com with ESMTPSA id f1sm13446951wik.1.2014.03.10.05.41.48 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Mar 2014 05:41:49 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Mon, 10 Mar 2014 12:41:46 +0000 Message-Id: <1394455306-13866-1-git-send-email-julien.grall@linaro.org> X-Mailer: git-send-email 1.7.10.4 Cc: Julien Grall , keir@xen.org, jbeulich@suse.com Subject: [Xen-devel] [PATCH v2] xen/malloc: handle correctly page allocation when align > size X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: julien.grall@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.173 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) 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-Archive: When align is superior to size, we need to retrieve the order from align during multiple page allocation. I guess it was the goal of the commit fb034f42 "xmalloc: make close-to-PAGE_SIZE allocations more efficient". Signed-off-by: Julien Grall Acked-by: Keir Fraser --- Changes in v2: - Use max --- xen/common/xmalloc_tlsf.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/xen/common/xmalloc_tlsf.c b/xen/common/xmalloc_tlsf.c index d3bdfa7..a5769c9 100644 --- a/xen/common/xmalloc_tlsf.c +++ b/xen/common/xmalloc_tlsf.c @@ -527,11 +527,10 @@ static void xmalloc_pool_put(void *p) static void *xmalloc_whole_pages(unsigned long size, unsigned long align) { - unsigned int i, order = get_order_from_bytes(size); + unsigned int i, order; void *res, *p; - if ( align > size ) - get_order_from_bytes(align); + order = get_order_from_bytes(max(align, size)); res = alloc_xenheap_pages(order, 0); if ( res == NULL )