From patchwork Fri Jul 18 07:56:00 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wang Nan X-Patchwork-Id: 33823 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ie0-f199.google.com (mail-ie0-f199.google.com [209.85.223.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id AB07F20CA0 for ; Fri, 18 Jul 2014 08:11:31 +0000 (UTC) Received: by mail-ie0-f199.google.com with SMTP id tr6sf31405145ieb.10 for ; Fri, 18 Jul 2014 01:11:31 -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=hHPOHQ2IuNUMhfLDsheDVOhc5jrZn+TzfF19vZd6d3E=; b=YOM34hv24ZhuF1plNjfhi2W8v6MMFZkxuXoagZoFPbbmwo5t/5UEDdkVW2/FeoL6Nx 6cE916Egcdi442CiBGpmExUcEwPJyWfOx6n4/F7UIsy2joD4xuJ5UxB/6thTFwtKMcQa uzSsEwQhEx9+k4nT57cpkyeahS6yhsstioslxK26uWgFtQ8J+S4QhfmoaM7jauYPF9mS HuF72mSVknf1Mslqvd+yxbXNOv3sp5SJyF75rApLMhiFEncHj/EqYwIjnNlciUfvKZj4 3aIo17FQTL8gkLyUCgqX+stpkU7dgBuUyTBzOgBtKqdpWv5o4w0bVsrbKJWuGh+OqZ6f e9dA== X-Gm-Message-State: ALoCoQkR+gjBcV3YLNcRqx5i79rB21LO8ZCJeUm7mPwjfNiHIDJb4hEWkLHw2ZFRwwndLZkQnfsf X-Received: by 10.42.151.67 with SMTP id d3mr1965002icw.6.1405671091237; Fri, 18 Jul 2014 01:11:31 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.36.244 with SMTP id p107ls930317qgp.50.gmail; Fri, 18 Jul 2014 01:11:31 -0700 (PDT) X-Received: by 10.220.3.79 with SMTP id 15mr2836053vcm.63.1405671091150; Fri, 18 Jul 2014 01:11:31 -0700 (PDT) Received: from mail-vc0-f181.google.com (mail-vc0-f181.google.com [209.85.220.181]) by mx.google.com with ESMTPS id vw2si4968236vcb.54.2014.07.18.01.11.31 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 18 Jul 2014 01:11:31 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.181 as permitted sender) client-ip=209.85.220.181; Received: by mail-vc0-f181.google.com with SMTP id lf12so6563423vcb.26 for ; Fri, 18 Jul 2014 01:11:31 -0700 (PDT) X-Received: by 10.52.244.81 with SMTP id xe17mr2637966vdc.24.1405671091059; Fri, 18 Jul 2014 01:11:31 -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 tc5csp101203vcb; Fri, 18 Jul 2014 01:11:30 -0700 (PDT) X-Received: by 10.66.255.38 with SMTP id an6mr2831241pad.43.1405671090224; Fri, 18 Jul 2014 01:11:30 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ct2si5030618pbc.92.2014.07.18.01.11.24; Fri, 18 Jul 2014 01:11:24 -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 S1760549AbaGRIKX (ORCPT + 23 others); Fri, 18 Jul 2014 04:10:23 -0400 Received: from szxga02-in.huawei.com ([119.145.14.65]:42552 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1760193AbaGRIKO (ORCPT ); Fri, 18 Jul 2014 04:10:14 -0400 Received: from 172.24.2.119 (EHLO lggeml406-hub.china.huawei.com) ([172.24.2.119]) by szxrg02-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id BWW27597; Fri, 18 Jul 2014 16:05:56 +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:47 +0800 From: Wang Nan To: Ingo Molnar , Yinghai Lu , "Mel Gorman" , Andrew Morton CC: Pei Feiyue , , , , , , Subject: [PATCH 2/5] memory-hotplug: x86_32: suitable memory should go to ZONE_MOVABLE Date: Fri, 18 Jul 2014 15:56:00 +0800 Message-ID: <1405670163-53747-3-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.181 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 x86_32. Signed-off-by: Wang Nan --- arch/x86/mm/init_32.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c index e395048..dd69833 100644 --- a/arch/x86/mm/init_32.c +++ b/arch/x86/mm/init_32.c @@ -826,9 +826,15 @@ int arch_add_memory(int nid, u64 start, u64 size) { struct pglist_data *pgdata = NODE_DATA(nid); struct zone *zone = pgdata->node_zones + ZONE_HIGHMEM; + struct zone *movable_zone = pgdat->node_zones + ZONE_MOVABLE; unsigned long start_pfn = start >> PAGE_SHIFT; unsigned long nr_pages = size >> PAGE_SHIFT; + 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); }