From patchwork Fri Nov 23 12:37:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 10695745 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5A7865A4 for ; Fri, 23 Nov 2018 12:37:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 49C1B2B881 for ; Fri, 23 Nov 2018 12:37:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3E1482BDDC; Fri, 23 Nov 2018 12:37:52 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE,SUBJ_OBFU_PUNCT_MANY autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0E0832B881 for ; Fri, 23 Nov 2018 12:37:50 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1F9CB6B2EA3; Fri, 23 Nov 2018 07:37:50 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 1A7EE6B2EA5; Fri, 23 Nov 2018 07:37:50 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0BF1F6B2F68; Fri, 23 Nov 2018 07:37:50 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-qk1-f200.google.com (mail-qk1-f200.google.com [209.85.222.200]) by kanga.kvack.org (Postfix) with ESMTP id D47BE6B2EA3 for ; Fri, 23 Nov 2018 07:37:49 -0500 (EST) Received: by mail-qk1-f200.google.com with SMTP id 98so11470810qkp.22 for ; Fri, 23 Nov 2018 04:37:49 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id; bh=5LEQHCwQHtPssv8q4lMYuEc5ITp1rorPD3whxnVBJDc=; b=IvSgzbXO13deDaUiEQltN9yEaM0NrM9a9EiFu4U+iWavQoTo/ovf7ckJp3CqHeTnoV LJN1CnNkVbjLXUSTs2knO2P7NTUQfEljP4w11PwOw19Nrw5GMG5Q+Gg8JYWJc1j4hAZD 7CDQ0t4S641Fr+6T2GW/3sbC/zuFoaet5jr1VzfR2iP+Vx+0N6j9PHs7Efy23wXkEQuf E8RF2CxOS/U7KHBxdAWHHCTiDewtY2S2U4ywWGye8FjehALz/8UFhkpP4jNumEOR1Jz9 qQqvPu5pobEo9Tc2gj1yDKbraeoe/I5MmKN0IvwISBmvaEwbXQqYvdZtgZN5qq5CzTHc AuhA== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of david@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=david@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com X-Gm-Message-State: AA+aEWbgxhVA7OZT++thNTTWhrA7BIBFfBZkDdUZ9IwUJJqkh0Hzs7kf xyfSGZIc5uUzSDloSbhGpT5B9Cn+YNP8bnK1SVElrfK2CwlMHDrPM+7FGzaWJLmbzscqJ0J/lk1 fXeuJ7aH/fBJT52sGvqAoXk775rZhXxQoVwEEVgMl6NT9+aF3R0ywhkIcavUkg4dTQw== X-Received: by 2002:a37:d6ce:: with SMTP id p75mr13385272qkl.270.1542976669627; Fri, 23 Nov 2018 04:37:49 -0800 (PST) X-Google-Smtp-Source: AFSGD/Usq3K82mMlmqieUa+Uh//IcRoCXmlr/m7YKYQsWYC+N7KYqdE19llsNj50qwn6uYBYuluh X-Received: by 2002:a37:d6ce:: with SMTP id p75mr13385204qkl.270.1542976668587; Fri, 23 Nov 2018 04:37:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542976668; cv=none; d=google.com; s=arc-20160816; b=ryCXofhdNWjC/G418qeRrvh21st33/NuedLru/5rc0r8/G7XGGPABpbeI2DW+Ai5Zu xwKVfdMMM3HHzxlwMNWo0DGcNzqLbg3zZmHt6bexP6+ZtT6MENtYjp1zYoYRGqLylsX5 V7GdyfuTadcWWLgRc9cdU9MZ6BOmFtaK7bUUPIjAWmBYPXe5Y8RLZK8j9KzG1heoQo0e Qu1w7s23PaZZu7S980hGq+VKW7uZpk/jlxOmGlUu9IXzLoByOSY5c10rOinrsEdqk9qj T+e2x8aBDpOswhhRo7tJDXJzQZHCoF0/mdtafQ/1lxLVXoaZVz59yKH/Zx9MNX8TF0hc HMwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:subject:cc:to:from; bh=5LEQHCwQHtPssv8q4lMYuEc5ITp1rorPD3whxnVBJDc=; b=eep3/bTBtM9bJ0Xyuse/D1UHaPxApVFnsHzSWgB2V6oeJr+9hVfakwZaoJBo76K1qn IR2aN71QJe4vl+lVzQC8jlO/dXFRUwpSqNacpzuQYPACursYydjeW2MV2Kcs7yEEldgV aUxh5yc03ImH37LjCC4VcHQy8ZwW9UpGhpCU4TyDkKPjzHCs4xk0yD9Sn8UWNu/u5xWf eZmDmO5Tb6wJ86Bj8cJ1opVlSttKzha/jVcCAbxTKgV8XrreHMWcpCROzQfF64EyoYFz OeqAU8llvNmJ0LzjjHhYJI6zeaM2RFfKa025F8usVnG5prSrMsZ7kAd2eUIyyGI/4zWc r5/Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of david@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=david@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from mx1.redhat.com (mx1.redhat.com. [209.132.183.28]) by mx.google.com with ESMTPS id z8si2646589qto.268.2018.11.23.04.37.48 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Nov 2018 04:37:48 -0800 (PST) Received-SPF: pass (google.com: domain of david@redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; Authentication-Results: mx.google.com; spf=pass (google.com: domain of david@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=david@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7066B4E8B7; Fri, 23 Nov 2018 12:37:47 +0000 (UTC) Received: from t460s.redhat.com (unknown [10.36.118.36]) by smtp.corp.redhat.com (Postfix) with ESMTP id 16C54194AE; Fri, 23 Nov 2018 12:37:40 +0000 (UTC) From: David Hildenbrand To: linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org, xen-devel@lists.xenproject.org, David Hildenbrand , Boris Ostrovsky , Juergen Gross , Stefano Stabellini , Andrew Morton , Dan Williams , Oscar Salvador , Pavel Tatashin , Michal Hocko , Joonsoo Kim , Arun KS , Mathieu Malaterre , Stephen Rothwell Subject: [PATCH v1] mm/memory_hotplug: drop "online" parameter from add_memory_resource() Date: Fri, 23 Nov 2018 13:37:40 +0100 Message-Id: <20181123123740.27652-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Fri, 23 Nov 2018 12:37:47 +0000 (UTC) X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP User space should always be in charge of how to online memory and if memory should be onlined automatically in the kernel. Let's drop the parameter to overwrite this - XEN passes memhp_auto_online, just like add_memory(), so we can directly use that instead internally. Cc: Boris Ostrovsky Cc: Juergen Gross Cc: Stefano Stabellini Cc: Andrew Morton Cc: Dan Williams Cc: Oscar Salvador Cc: Pavel Tatashin Cc: Michal Hocko Cc: David Hildenbrand Cc: Joonsoo Kim Cc: Arun KS Cc: Mathieu Malaterre Cc: Stephen Rothwell Signed-off-by: David Hildenbrand Acked-by: Michal Hocko Reviewed-by: Oscar Salvador Acked-by: Juergen Gross --- drivers/xen/balloon.c | 2 +- include/linux/memory_hotplug.h | 2 +- mm/memory_hotplug.c | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c index 12148289debd..81ba448166cd 100644 --- a/drivers/xen/balloon.c +++ b/drivers/xen/balloon.c @@ -397,7 +397,7 @@ static enum bp_state reserve_additional_memory(void) mutex_unlock(&balloon_mutex); /* add_memory_resource() requires the device_hotplug lock */ lock_device_hotplug(); - rc = add_memory_resource(nid, resource, memhp_auto_online); + rc = add_memory_resource(nid, resource); unlock_device_hotplug(); mutex_lock(&balloon_mutex); diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h index 84e9ae205930..ebc99f29aeae 100644 --- a/include/linux/memory_hotplug.h +++ b/include/linux/memory_hotplug.h @@ -326,7 +326,7 @@ extern int walk_memory_range(unsigned long start_pfn, unsigned long end_pfn, void *arg, int (*func)(struct memory_block *, void *)); extern int __add_memory(int nid, u64 start, u64 size); extern int add_memory(int nid, u64 start, u64 size); -extern int add_memory_resource(int nid, struct resource *resource, bool online); +extern int add_memory_resource(int nid, struct resource *resource); extern int arch_add_memory(int nid, u64 start, u64 size, struct vmem_altmap *altmap, bool want_memblock); extern void move_pfn_range_to_zone(struct zone *zone, unsigned long start_pfn, diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index 7b4317ae8318..7b64bbf645c3 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c @@ -1096,7 +1096,7 @@ static int online_memory_block(struct memory_block *mem, void *arg) * * we are OK calling __meminit stuff here - we have CONFIG_MEMORY_HOTPLUG */ -int __ref add_memory_resource(int nid, struct resource *res, bool online) +int __ref add_memory_resource(int nid, struct resource *res) { u64 start, size; bool new_node = false; @@ -1151,7 +1151,7 @@ int __ref add_memory_resource(int nid, struct resource *res, bool online) mem_hotplug_done(); /* online pages if requested */ - if (online) + if (memhp_auto_online) walk_memory_range(PFN_DOWN(start), PFN_UP(start + size - 1), NULL, online_memory_block); @@ -1175,7 +1175,7 @@ int __ref __add_memory(int nid, u64 start, u64 size) if (IS_ERR(res)) return PTR_ERR(res); - ret = add_memory_resource(nid, res, memhp_auto_online); + ret = add_memory_resource(nid, res); if (ret < 0) release_memory_resource(res); return ret;