From patchwork Fri Jul 18 07:55:59 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wang Nan X-Patchwork-Id: 33822 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 AA75C20CA0 for ; Fri, 18 Jul 2014 08:10:47 +0000 (UTC) Received: by mail-pa0-f69.google.com with SMTP id kx10sf25521420pab.0 for ; Fri, 18 Jul 2014 01:10:47 -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=iY20oBPG/TgzyB9TJxLFItISXd/ZjHLmdajSS2waQXE=; b=i6I7VXyBKiWM3oNfs0jc2yP4G00zvRuyh++i+17pFoHWcM0gQMzNnhgmYwCEsWzCGb LP8v+axrwgwo1HJXiP4brraqHyCxTiI9CzCzltUI1uE4TQubBb8L07w72xJUM8l9p7JT yhon7t80lyIyCsZIZZa27ztFTsVxXvEVWyyyURSYx58Upttu/LSHAwrh9LkbqeZ2px87 Heo6KOBNzVuvcLohADOrQ4aM6CyZ6k0yLrlj1kxmVggTBcBjPahzVezk8aFzUn2GlaW9 DktWSN0yB+mjK9x10MPTAxMwTFXvcPXnvckvo5eKDZIrNXwFmwzFek72zH6sZc3FT6H6 XwVg== X-Gm-Message-State: ALoCoQlVAxm9pzeoxpR1l0E6VmreKZ9ZmsmY2lMSTIZAHS/YYVp/ZyoQjmNOFzfmTmyeNyWb84Pp X-Received: by 10.66.231.68 with SMTP id te4mr1574170pac.29.1405671047012; Fri, 18 Jul 2014 01:10:47 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.101.231 with SMTP id u94ls927809qge.62.gmail; Fri, 18 Jul 2014 01:10:46 -0700 (PDT) X-Received: by 10.52.252.226 with SMTP id zv2mr2460003vdc.19.1405671046911; Fri, 18 Jul 2014 01:10:46 -0700 (PDT) Received: from mail-vc0-f173.google.com (mail-vc0-f173.google.com [209.85.220.173]) by mx.google.com with ESMTPS id uy6si4975531vcb.23.2014.07.18.01.10.46 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 18 Jul 2014 01:10:46 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.173 as permitted sender) client-ip=209.85.220.173; Received: by mail-vc0-f173.google.com with SMTP id hy10so6720899vcb.32 for ; Fri, 18 Jul 2014 01:10:46 -0700 (PDT) X-Received: by 10.220.15.8 with SMTP id i8mr2863446vca.45.1405671046832; Fri, 18 Jul 2014 01:10:46 -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 tc5csp101161vcb; Fri, 18 Jul 2014 01:10:46 -0700 (PDT) X-Received: by 10.66.100.231 with SMTP id fb7mr2952306pab.94.1405671045812; Fri, 18 Jul 2014 01:10:45 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ow8si2527742pdb.76.2014.07.18.01.10.45; Fri, 18 Jul 2014 01:10:45 -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 S1760610AbaGRIK1 (ORCPT + 23 others); Fri, 18 Jul 2014 04:10:27 -0400 Received: from szxga02-in.huawei.com ([119.145.14.65]:42562 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757745AbaGRIKO (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 BWW27598; 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:46 +0800 From: Wang Nan To: Ingo Molnar , Yinghai Lu , "Mel Gorman" , Andrew Morton CC: Pei Feiyue , , , , , , Subject: [PATCH 1/5] memory-hotplug: x86_64: suitable memory should go to ZONE_MOVABLE Date: Fri, 18 Jul 2014 15:55:59 +0800 Message-ID: <1405670163-53747-2-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.173 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_64. Signed-off-by: Wang Nan --- arch/x86/mm/init_64.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c index df1a992..825915e 100644 --- a/arch/x86/mm/init_64.c +++ b/arch/x86/mm/init_64.c @@ -685,17 +685,23 @@ static void update_end_of_memory_vars(u64 start, u64 size) } /* - * Memory is added always to NORMAL zone. This means you will never get - * additional DMA/DMA32 memory. + * Memory is added always to NORMAL or MOVABLE zone. This means you + * will never get additional DMA/DMA32 memory. */ int arch_add_memory(int nid, u64 start, u64 size) { struct pglist_data *pgdat = NODE_DATA(nid); struct zone *zone = pgdat->node_zones + ZONE_NORMAL; + struct zone *movable_zone = pgdat->node_zones + ZONE_MOVABLE; unsigned long start_pfn = start >> PAGE_SHIFT; unsigned long nr_pages = size >> PAGE_SHIFT; int ret; + if (!zone_is_empty(movable_zone)) + if (zone_spans_pfn(movable_zone, start_pfn) || + (zone_end_pfn(movable_zone) <= start_pfn)) + zone = movable_zone; + init_memory_mapping(start, start + size); ret = __add_pages(nid, zone, start_pfn, nr_pages);