From patchwork Fri Jul 18 07:56:03 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wang Nan X-Patchwork-Id: 33821 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oa0-f69.google.com (mail-oa0-f69.google.com [209.85.219.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 2153120CA0 for ; Fri, 18 Jul 2014 08:10:00 +0000 (UTC) Received: by mail-oa0-f69.google.com with SMTP id i7sf12559401oag.4 for ; Fri, 18 Jul 2014 01:09:59 -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:cc:subject:date:message-id :in-reply-to:references: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; bh=Wjhq8kTd1KRBJkWJ5wJm+vfMmTaWgWXYu05t6xOrk9o=; b=Be9NeN+lek41QgFN3XRjFqt9ToUtjDVe9miBrIsdmnvI8K+9Drpk5s38FdMhQ2zYdO bdzU5vwDZWYVhjCGwoa3z9BjX/lsGxyU17RAhUisO1FrsdCyRcIDOBPKoKmZSelKCtbK 1eAdhr70kpAl9dO3TtzI6F6Bpr8/zVkDtHuVXUJAlmFcg/Q7xdKj60qjCOBcIY7MDyb9 JQZVcUS30QvXpZI+9n1tPitlSf0+e8XAXPzkwoKykGaWIA2RJUyndSKEBNOu6BRaXKZN jv+Npag29BLPanLkdLn2pldfTcXI4Dzv3iMUBSMrO8YxVWf0HHSchYSaDU0ZyB1R/w4V HHvw== X-Gm-Message-State: ALoCoQnTrsKT12oQQ7Yh0ErnjYeVQ8zrAc7t7Svnp1afmHNXWvYGEyQeltohluasGdgzVgyzBJxJ X-Received: by 10.50.33.18 with SMTP id n18mr1602440igi.8.1405670999708; Fri, 18 Jul 2014 01:09:59 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.27.171 with SMTP id 40ls914049qgx.9.gmail; Fri, 18 Jul 2014 01:09:59 -0700 (PDT) X-Received: by 10.52.12.229 with SMTP id b5mr2569062vdc.52.1405670999613; Fri, 18 Jul 2014 01:09:59 -0700 (PDT) Received: from mail-vc0-f169.google.com (mail-vc0-f169.google.com [209.85.220.169]) by mx.google.com with ESMTPS id k8si4958285vdv.58.2014.07.18.01.09.59 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 18 Jul 2014 01:09:59 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.169 as permitted sender) client-ip=209.85.220.169; Received: by mail-vc0-f169.google.com with SMTP id hu12so6867799vcb.28 for ; Fri, 18 Jul 2014 01:09:59 -0700 (PDT) X-Received: by 10.52.244.138 with SMTP id xg10mr2591996vdc.40.1405670999539; Fri, 18 Jul 2014 01:09:59 -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 tc5csp101107vcb; Fri, 18 Jul 2014 01:09:59 -0700 (PDT) X-Received: by 10.66.123.36 with SMTP id lx4mr2855817pab.21.1405670998673; Fri, 18 Jul 2014 01:09:58 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d7si2520662pdj.181.2014.07.18.01.09.58; Fri, 18 Jul 2014 01:09:58 -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 S1759781AbaGRIJQ (ORCPT + 23 others); Fri, 18 Jul 2014 04:09:16 -0400 Received: from szxga01-in.huawei.com ([119.145.14.64]:27089 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755318AbaGRIJJ (ORCPT ); Fri, 18 Jul 2014 04:09:09 -0400 Received: from 172.24.2.119 (EHLO lggeml406-hub.china.huawei.com) ([172.24.2.119]) by szxrg01-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id BYX42638; Fri, 18 Jul 2014 16:06:00 +0800 (CST) Received: from kernel-host.huawei (10.107.197.247) by lggeml406-hub.china.huawei.com (10.72.61.84) with Microsoft SMTP Server id 14.3.158.1; Fri, 18 Jul 2014 16:05:49 +0800 From: Wang Nan To: Ingo Molnar , Yinghai Lu , "Mel Gorman" , Andrew Morton CC: Pei Feiyue , , , , , , Subject: [PATCH 5/5] memory-hotplug: powerpc: suitable memory should go to ZONE_MOVABLE Date: Fri, 18 Jul 2014 15:56:03 +0800 Message-ID: <1405670163-53747-6-git-send-email-wangnan0@huawei.com> X-Mailer: git-send-email 1.8.4 In-Reply-To: <1405670163-53747-1-git-send-email-wangnan0@huawei.com> References: <1405670163-53747-1-git-send-email-wangnan0@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.107.197.247] X-CFilter-Loop: Reflected 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: wangnan0@huawei.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.220.169 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: , This patch add new memory to ZONE_MOVABLE if movable zone is setup and lower than newly added memory for powerpc. Signed-off-by: Wang Nan --- arch/powerpc/mm/mem.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c index 2c8e90f..2d869ef 100644 --- a/arch/powerpc/mm/mem.c +++ b/arch/powerpc/mm/mem.c @@ -118,6 +118,7 @@ int arch_add_memory(int nid, u64 start, u64 size) { struct pglist_data *pgdata; struct zone *zone; + struct zone *movable_zone; unsigned long start_pfn = start >> PAGE_SHIFT; unsigned long nr_pages = size >> PAGE_SHIFT; @@ -129,6 +130,11 @@ int arch_add_memory(int nid, u64 start, u64 size) /* this should work for most non-highmem platforms */ zone = pgdata->node_zones; + movable_zone = pgdat->node_zones + ZONE_MOVABLE; + if (!zone_is_empty(movable_zone)) + if (zone_spans_pfn(movable_zone, start_pfn) || + (zone_end_pfn(movable_zone) <= start_pfn)) + zone = movable_zone; return __add_pages(nid, zone, start_pfn, nr_pages); }