From patchwork Fri Jul 18 07:56:02 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wang Nan X-Patchwork-Id: 33820 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qg0-f71.google.com (mail-qg0-f71.google.com [209.85.192.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id D179020CA0 for ; Fri, 18 Jul 2014 08:09:40 +0000 (UTC) Received: by mail-qg0-f71.google.com with SMTP id f51sf7016287qge.10 for ; Fri, 18 Jul 2014 01:09:40 -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=5MBybyd33rT692966aoZ/dGC9GCa2+5i+hMlwkiAYZw=; b=CaMHl9QnCPeEJUfPvfY0HakVKRD3ol4175PVdXqvEXsiy4ahI1jD8ShXaKLwjhW4yG 2SPSJuSBIGoLNHe3fQ6kCAXQNbYLOb0TnAh5eXxOiROyJfMEFhWj5F98jF9giH7VHopv 3aKM0EGsPr+3w8WxnB6btEwFjc/h3o0hh6e3oYmxvVxFMCaLO218oREiSqU0XwAdCf9Y YKCcrGMve03eAmjQlnD+8hkze/skJRRS8K/cy5D/5bG8m1tfn9PRzlXBNTcGIg8wJ76j JRRjUrxYxCdKHi2smCzRLJ0v5zhEO5MjiwDQgzNGlanwInhmnQZyZ82RsMnH+eFokrEp ONpg== X-Gm-Message-State: ALoCoQmsTj6+pzMoMel5JtScHj/OnAcez7aiCfsRLxvEPkIFx8k8NTTcX07/ZG//SiK3M8Kpeebb X-Received: by 10.182.68.17 with SMTP id r17mr1570133obt.26.1405670980597; Fri, 18 Jul 2014 01:09:40 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.48.112 with SMTP id n103ls922854qga.86.gmail; Fri, 18 Jul 2014 01:09:40 -0700 (PDT) X-Received: by 10.52.7.163 with SMTP id k3mr2550611vda.58.1405670980494; Fri, 18 Jul 2014 01:09:40 -0700 (PDT) Received: from mail-vc0-f176.google.com (mail-vc0-f176.google.com [209.85.220.176]) by mx.google.com with ESMTPS id s6si4952007vdz.85.2014.07.18.01.09.40 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 18 Jul 2014 01:09:40 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.176 as permitted sender) client-ip=209.85.220.176; Received: by mail-vc0-f176.google.com with SMTP id id10so2100217vcb.7 for ; Fri, 18 Jul 2014 01:09:40 -0700 (PDT) X-Received: by 10.221.47.9 with SMTP id uq9mr3063828vcb.48.1405670980406; Fri, 18 Jul 2014 01:09:40 -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 tc5csp101088vcb; Fri, 18 Jul 2014 01:09:39 -0700 (PDT) X-Received: by 10.68.57.165 with SMTP id j5mr2794118pbq.147.1405670979467; Fri, 18 Jul 2014 01:09:39 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id pt4si5038316pac.82.2014.07.18.01.09.36; Fri, 18 Jul 2014 01:09:36 -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 S1760144AbaGRIJY (ORCPT + 23 others); Fri, 18 Jul 2014 04:09:24 -0400 Received: from szxga01-in.huawei.com ([119.145.14.64]:27090 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751084AbaGRIJK (ORCPT ); Fri, 18 Jul 2014 04:09:10 -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 BYX42637; 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:48 +0800 From: Wang Nan To: Ingo Molnar , Yinghai Lu , "Mel Gorman" , Andrew Morton CC: Pei Feiyue , , , , , , Subject: [PATCH 4/5] memory-hotplug: sh: suitable memory should go to ZONE_MOVABLE Date: Fri, 18 Jul 2014 15:56:02 +0800 Message-ID: <1405670163-53747-5-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.176 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 sh. Signed-off-by: Wang Nan --- arch/sh/mm/init.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/arch/sh/mm/init.c b/arch/sh/mm/init.c index 2d089fe..ff9decc 100644 --- a/arch/sh/mm/init.c +++ b/arch/sh/mm/init.c @@ -487,16 +487,19 @@ void free_initrd_mem(unsigned long start, unsigned long end) #ifdef CONFIG_MEMORY_HOTPLUG int arch_add_memory(int nid, u64 start, u64 size) { - pg_data_t *pgdat; + pg_data_t *pgdat = NODE_DATA(nid); unsigned long start_pfn = start >> PAGE_SHIFT; unsigned long nr_pages = size >> PAGE_SHIFT; + struct zone *zone = pgdat->node_zones + ZONE_NORMAL; + struct zone *movable_zone = pgdat->node_zones + ZONE_MOVABLE; int ret; - pgdat = NODE_DATA(nid); + if (!zone_is_empty(movable_zone)) + if (zone_spans_pfn(movable_zone, start_pfn) || + (zone_end_pfn(movable_zone) <= start_pfn)) + zone = movable_zone; - /* We only have ZONE_NORMAL, so this is easy.. */ - ret = __add_pages(nid, pgdat->node_zones + ZONE_NORMAL, - start_pfn, nr_pages); + ret = __add_pages(nid, zone, start_pfn, nr_pages); if (unlikely(ret)) printk("%s: Failed, __add_pages() == %d\n", __func__, ret);