Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp969284ybl; Wed, 14 Aug 2019 08:42:32 -0700 (PDT) X-Google-Smtp-Source: APXvYqxBbWj8qJYYQH6jHBkj+KMoOPd6gZeJIFK6o7S0tEB7S0ffeWTtj6nwxHJJFXe03XYW0cDt X-Received: by 2002:a63:7b4d:: with SMTP id k13mr29289791pgn.182.1565797352335; Wed, 14 Aug 2019 08:42:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565797352; cv=none; d=google.com; s=arc-20160816; b=N1HzAQ2VLdCND6kdxfWpq1/xP2EFjTOG50R//yk2ZrUzd6R7tV6hiQan6OJdO9t5mP sG4eGGufY8NjrwT7zE9K0Xi39neYO1+Jo4gP1YUF7OLy9Oz0b469NOSGeHEeilaNqoLp 1S933GiOUGZQflkXK3IcFma+OxaVvXq+MCVbYKulzNbHj5Hpa7t9tR1enHhbmnwdZ3Ue LMW06LAufvFBysKZZUWRQsnvelPsisFiXl41lDMXPX1BPJOFosHnuyhXpoVGUz01QKhP x2C15tSnVUbvkW2qk8f6sh6sIMpoKbE9lxzg5UvDchLQ0EwlXTSno4Ejb41Pj6zib0Ni i3cQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=tH67ybh/Yxy9e5pltD9MobmLa1lhXlTWVU4+iczn0zk=; b=l5KdgRQrfWSnsN5AyVPWHEw35x3bvxcrIz7mDbemBpKbn2q8t2ksIc9RZGF1ulfX91 blQBbtIc3JCyfU72hZIGHYICIvuKJxqq2/d5YrObuiE+6TXGzndI5ACC/2UDGE5S7+GG QJ3rQgc4fT9+930PqFmSNtMMWsM80JirkZoaV8IOHUlun821VKuwljRF6inryiaEeavD IRpc1SYs8lWrAvdqqmPSGoit00w824z0vAqaTYAN/GOCi1b4HhoCGwoAhJxnurgKwohf aapK98/BlHVq7rdhjES4zkWmIDY8SwdJxsIpqpXN8VoBq4LGH+Dn1V5BdHdRGgXj4dSS Yx/w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x14si88130pjf.45.2019.08.14.08.42.10; Wed, 14 Aug 2019 08:42:32 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728245AbfHNPl1 (ORCPT + 99 others); Wed, 14 Aug 2019 11:41:27 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45860 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728204AbfHNPl0 (ORCPT ); Wed, 14 Aug 2019 11:41:26 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 777C7309BDA0; Wed, 14 Aug 2019 15:41:26 +0000 (UTC) Received: from t460s.redhat.com (ovpn-116-49.ams2.redhat.com [10.36.116.49]) by smtp.corp.redhat.com (Postfix) with ESMTP id CC13D80693; Wed, 14 Aug 2019 15:41:24 +0000 (UTC) From: David Hildenbrand To: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, David Hildenbrand , Andrew Morton , Oscar Salvador , Michal Hocko , Pavel Tatashin , Dan Williams Subject: [PATCH v2 5/5] mm/memory_hotplug: online_pages cannot be 0 in online_pages() Date: Wed, 14 Aug 2019 17:41:09 +0200 Message-Id: <20190814154109.3448-6-david@redhat.com> In-Reply-To: <20190814154109.3448-1-david@redhat.com> References: <20190814154109.3448-1-david@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Wed, 14 Aug 2019 15:41:26 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org walk_system_ram_range() will fail with -EINVAL in case online_pages_range() was never called (== no resource applicable in the range). Otherwise, we will always call online_pages_range() with nr_pages > 0 and, therefore, have online_pages > 0. Remove that special handling. Cc: Andrew Morton Cc: Oscar Salvador Cc: Michal Hocko Cc: Pavel Tatashin Cc: Dan Williams Acked-by: Michal Hocko Signed-off-by: David Hildenbrand --- mm/memory_hotplug.c | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index f245fb50ba7f..01456fc66564 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c @@ -853,6 +853,7 @@ int __ref online_pages(unsigned long pfn, unsigned long nr_pages, int online_typ ret = walk_system_ram_range(pfn, nr_pages, &onlined_pages, online_pages_range); if (ret) { + /* not a single memory resource was applicable */ if (need_zonelists_rebuild) zone_pcp_reset(zone); goto failed_addition; @@ -866,27 +867,22 @@ int __ref online_pages(unsigned long pfn, unsigned long nr_pages, int online_typ shuffle_zone(zone); - if (onlined_pages) { - node_states_set_node(nid, &arg); - if (need_zonelists_rebuild) - build_all_zonelists(NULL); - else - zone_pcp_update(zone); - } + node_states_set_node(nid, &arg); + if (need_zonelists_rebuild) + build_all_zonelists(NULL); + else + zone_pcp_update(zone); init_per_zone_wmark_min(); - if (onlined_pages) { - kswapd_run(nid); - kcompactd_run(nid); - } + kswapd_run(nid); + kcompactd_run(nid); vm_total_pages = nr_free_pagecache_pages(); writeback_set_ratelimit(); - if (onlined_pages) - memory_notify(MEM_ONLINE, &arg); + memory_notify(MEM_ONLINE, &arg); mem_hotplug_done(); return 0; -- 2.21.0