From patchwork Fri Jun 14 10:01:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 10994941 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 4FBF413AF for ; Fri, 14 Jun 2019 10:01:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3F31D283BF for ; Fri, 14 Jun 2019 10:01:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 32CF621EEB; Fri, 14 Jun 2019 10:01:59 +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 autolearn=unavailable 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 88935283CA for ; Fri, 14 Jun 2019 10:01:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 703476B000A; Fri, 14 Jun 2019 06:01:55 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 68C6D6B000E; Fri, 14 Jun 2019 06:01:55 -0400 (EDT) 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 505BD6B0266; Fri, 14 Jun 2019 06:01:55 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-qk1-f199.google.com (mail-qk1-f199.google.com [209.85.222.199]) by kanga.kvack.org (Postfix) with ESMTP id 14E686B000A for ; Fri, 14 Jun 2019 06:01:55 -0400 (EDT) Received: by mail-qk1-f199.google.com with SMTP id j128so1560686qkd.23 for ; Fri, 14 Jun 2019 03:01:55 -0700 (PDT) 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:in-reply-to:references:mime-version :content-transfer-encoding; bh=XUeHS9AZadK84qxFCdY83begAnJlSImfQEMVyNXLF2M=; b=o/6Ymepm9xHjx77xxl9ZorLpK3QCOGIViEHcP5ZVDaqWCrD5cchA1rZJWyyswIjtQr XGpDKGc8PyuaPTSnpiNfoH98WPbCHG52Te/1IJX7l6WkRmFyvsTKyfh4kD0dyDYblrKp 4mmBdbHYjcxHgpnQ6lq0+0oV1DpopPkrMsXFQwNSXBM6qADe7vBdlJS+A+KkakXHNgDf e/JJvfMYkUwJNQuJky8B86yt4c/04Mj4xlVxi55lKmBygOaynoqy+1L7tBvYZLnX7Kfn +/5obHeewLKPfsf+4ZRlB9HazwKi6fK4ADQwaSJMFTBxVg17tBJPP4b+VmZ5jq916Zet FqOA== 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: APjAAAV27vt+5Hoe8KcpeZOLm/zcJs4VmXsyZMi5BrYoIUVJ6YsZjIPX fXOqbSw15fqY6SseK+hIlxERXcPzoydF7VLm2kX+mhpc7TsETwO/g0itQdBE/Gc2t+ZJZc4JjPZ hMm03GU7n2J4BlE3tn0I1hKN5q7UOrwI5l06jO0orjvkFW5WkuWQMw/TCysacO5jwaA== X-Received: by 2002:a05:620a:10b2:: with SMTP id h18mr9879402qkk.14.1560506514780; Fri, 14 Jun 2019 03:01:54 -0700 (PDT) X-Google-Smtp-Source: APXvYqztQ84lBxOahUEsygA0qwZpMQU495nI/eD6Tpvdu18LQzTdUpRBgQimiWt7CDngfHauxaXy X-Received: by 2002:a05:620a:10b2:: with SMTP id h18mr9879319qkk.14.1560506513792; Fri, 14 Jun 2019 03:01:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560506513; cv=none; d=google.com; s=arc-20160816; b=Khy8HWz9A94xXje495XGEpQeWpLsFrm8buCS/eDKAaeiPF2Eexcb3L9kxecSPhV2a2 Fcfp1Krnj3+unPVuRaaXsZzBgqhLRXMEOQJYJYZbQkL2MUMfYB05ypwW7SQB225TGY0B sUG2QW7QOe4CE8jmEzPdQW8TZLsVUV4Om4N0q3byVlhrtuITNjQ1PN54VrZcQEaP/rkw bkUeAcdv6HoBcij8vuKURPvW+Xg62XycET6D8uOPNjpCctkSEgBoqwYGcIMwCCF3Ty5f hrc9KYvnid5TFGemirox+UD0b4erqIcQ5kgKGtDZzYbmdDdnX8f48M9JP6+rwkdYYIOO rXKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=XUeHS9AZadK84qxFCdY83begAnJlSImfQEMVyNXLF2M=; b=HQq2R4Ibxz1z/+cRAWOEntek5IbAjVQ8qyK4tcGKwMhbQAxcZeE5Zb9B+6gpDLGpYM x1vU0eKrMHve8qBmvDgM3qyQmp1lNkA53CsBwX4epfbzX5AgDxEJcOUBZyWB6JVsjIgJ r3vsMsw9bMBdVMEQb+PyPaS/yetEhxH52CERaBxbiY2PKRa0DJqPP1Nx1U+qr1Lm/Zjy UlW21eHxeRlsQFOgdZXhKFKNMpgvEzD2Nx4+aF1EhVn+EtgoLZy529Xy4gdhOwbaXORu fVXtLF8CkrMq/N9xII9XzkwC/+g7kqrhwcrckeAEeDk0nxeH3xnf3L3uKfxMa93iHtNn wZfw== 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 f13si1331333qve.55.2019.06.14.03.01.53 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 14 Jun 2019 03:01:53 -0700 (PDT) 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-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6C2B1356DA; Fri, 14 Jun 2019 10:01:42 +0000 (UTC) Received: from t460s.redhat.com (ovpn-116-252.ams2.redhat.com [10.36.116.252]) by smtp.corp.redhat.com (Postfix) with ESMTP id CC6615D9D2; Fri, 14 Jun 2019 10:01:33 +0000 (UTC) From: David Hildenbrand To: linux-kernel@vger.kernel.org Cc: Dan Williams , Andrew Morton , linuxppc-dev@lists.ozlabs.org, linux-acpi@vger.kernel.org, linux-mm@kvack.org, David Hildenbrand , Greg Kroah-Hartman , "Rafael J. Wysocki" , Vlastimil Babka , Michal Hocko , Mel Gorman , Wei Yang , Johannes Weiner , Arun KS , Pavel Tatashin , Oscar Salvador , Stephen Rothwell , Mike Rapoport , Baoquan He Subject: [PATCH v1 1/6] mm: Section numbers use the type "unsigned long" Date: Fri, 14 Jun 2019 12:01:09 +0200 Message-Id: <20190614100114.311-2-david@redhat.com> In-Reply-To: <20190614100114.311-1-david@redhat.com> References: <20190614100114.311-1-david@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Fri, 14 Jun 2019 10:01:42 +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 We are using a mixture of "int" and "unsigned long". Let's make this consistent by using "unsigned long" everywhere. We'll do the same with memory block ids next. Cc: Greg Kroah-Hartman Cc: "Rafael J. Wysocki" Cc: Andrew Morton Cc: Vlastimil Babka Cc: Michal Hocko Cc: Dan Williams Cc: Mel Gorman Cc: Wei Yang Cc: Johannes Weiner Cc: Arun KS Cc: Pavel Tatashin Cc: Oscar Salvador Cc: Stephen Rothwell Cc: Mike Rapoport Cc: Baoquan He Signed-off-by: David Hildenbrand --- drivers/base/memory.c | 9 +++++---- include/linux/mmzone.h | 4 ++-- mm/sparse.c | 12 ++++++------ 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/drivers/base/memory.c b/drivers/base/memory.c index 826dd76f662e..5b3a2fd250ba 100644 --- a/drivers/base/memory.c +++ b/drivers/base/memory.c @@ -34,7 +34,7 @@ static DEFINE_MUTEX(mem_sysfs_mutex); static int sections_per_block; -static inline int base_memory_block_id(int section_nr) +static inline int base_memory_block_id(unsigned long section_nr) { return section_nr / sections_per_block; } @@ -691,10 +691,11 @@ static int init_memory_block(struct memory_block **memory, int block_id, return ret; } -static int add_memory_block(int base_section_nr) +static int add_memory_block(unsigned long base_section_nr) { + int ret, section_count = 0; struct memory_block *mem; - int i, ret, section_count = 0; + unsigned long i; for (i = base_section_nr; i < base_section_nr + sections_per_block; @@ -822,7 +823,7 @@ static const struct attribute_group *memory_root_attr_groups[] = { */ int __init memory_dev_init(void) { - unsigned int i; + unsigned long i; int ret; int err; unsigned long block_sz; diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index 427b79c39b3c..83b6aae16f13 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h @@ -1220,7 +1220,7 @@ static inline struct mem_section *__nr_to_section(unsigned long nr) return NULL; return &mem_section[SECTION_NR_TO_ROOT(nr)][nr & SECTION_ROOT_MASK]; } -extern int __section_nr(struct mem_section* ms); +extern unsigned long __section_nr(struct mem_section *ms); extern unsigned long usemap_size(void); /* @@ -1292,7 +1292,7 @@ static inline struct mem_section *__pfn_to_section(unsigned long pfn) return __nr_to_section(pfn_to_section_nr(pfn)); } -extern int __highest_present_section_nr; +extern unsigned long __highest_present_section_nr; #ifndef CONFIG_HAVE_ARCH_PFN_VALID static inline int pfn_valid(unsigned long pfn) diff --git a/mm/sparse.c b/mm/sparse.c index 1552c855d62a..e8c57e039be8 100644 --- a/mm/sparse.c +++ b/mm/sparse.c @@ -102,7 +102,7 @@ static inline int sparse_index_init(unsigned long section_nr, int nid) #endif #ifdef CONFIG_SPARSEMEM_EXTREME -int __section_nr(struct mem_section* ms) +unsigned long __section_nr(struct mem_section *ms) { unsigned long root_nr; struct mem_section *root = NULL; @@ -121,9 +121,9 @@ int __section_nr(struct mem_section* ms) return (root_nr * SECTIONS_PER_ROOT) + (ms - root); } #else -int __section_nr(struct mem_section* ms) +unsigned long __section_nr(struct mem_section *ms) { - return (int)(ms - mem_section[0]); + return (unsigned long)(ms - mem_section[0]); } #endif @@ -178,10 +178,10 @@ void __meminit mminit_validate_memmodel_limits(unsigned long *start_pfn, * Keeping track of this gives us an easy way to break out of * those loops early. */ -int __highest_present_section_nr; +unsigned long __highest_present_section_nr; static void section_mark_present(struct mem_section *ms) { - int section_nr = __section_nr(ms); + unsigned long section_nr = __section_nr(ms); if (section_nr > __highest_present_section_nr) __highest_present_section_nr = section_nr; @@ -189,7 +189,7 @@ static void section_mark_present(struct mem_section *ms) ms->section_mem_map |= SECTION_MARKED_PRESENT; } -static inline int next_present_section_nr(int section_nr) +static inline unsigned long next_present_section_nr(unsigned long section_nr) { do { section_nr++; From patchwork Fri Jun 14 10:01:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 10994953 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 8807313AF for ; Fri, 14 Jun 2019 10:02:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7A4A428409 for ; Fri, 14 Jun 2019 10:02:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6EA312842A; Fri, 14 Jun 2019 10:02:09 +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 autolearn=unavailable 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 F3C6E205F8 for ; Fri, 14 Jun 2019 10:02:08 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 110FA6B0269; Fri, 14 Jun 2019 06:02:06 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id EF2326B026A; Fri, 14 Jun 2019 06:02:05 -0400 (EDT) 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 D1DA06B026B; Fri, 14 Jun 2019 06:02:05 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-qt1-f198.google.com (mail-qt1-f198.google.com [209.85.160.198]) by kanga.kvack.org (Postfix) with ESMTP id A952A6B0269 for ; Fri, 14 Jun 2019 06:02:05 -0400 (EDT) Received: by mail-qt1-f198.google.com with SMTP id s9so1645430qtn.14 for ; Fri, 14 Jun 2019 03:02:05 -0700 (PDT) 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:in-reply-to:references:mime-version :content-transfer-encoding; bh=2BnEF5DjEUXKUN68Cu5GloZzc1NrCiCe4crz0f6bDtE=; b=W/1+s2jjiVS4d9LRLSG9Wi8nSI/4LSHraUVnU91wOgIEqApdN0pY+dSgpqH9bFDGpQ rAbGlvFd390uJxKT7uRV1J8AsFZjst8cNKLjhsmCWnk/yjVOHyeyNxc/A+qaZZNcQcLr /odXb68eAUWxWgC/TU90SCmu1DeES2Ufn799n2y7NFXPxQ/2b/CL3grJiX8jKMgq+P9p W5F7dF86vJh7uBYGq7Hy8Fpb+Rs8g+cknOMv7J/EPffDDRwVnKSF3zvkjg1Sy9t3C0EP ON9DRk/zNh0bNTeEs9PKBJ08PuQDHzakMmpOTcAgNAO51qW9pXFxeAWagBdnGK7yq8E6 y7Dg== 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: APjAAAXHvj/i4Zt0xPV4He3CYKNI3lWy9KX18Ah8JvsGYbNdUScl9OwU lmiyKa2vrMe2aiaSnz+KSZmxGQp6ttoQyF3YoWIHcXVGcICNEkTS86pQPXX7//YTFsShUm0fbaH aw3LpMiNXir7/upu9F8vIwIJQTVOg6dvEMN5OCX+CI6GMolwag1Ewz6tmGuczGQb+4Q== X-Received: by 2002:a37:9481:: with SMTP id w123mr56257242qkd.319.1560506525473; Fri, 14 Jun 2019 03:02:05 -0700 (PDT) X-Google-Smtp-Source: APXvYqwkUe1aKaehd6oTTSVpFE3Cpze1E0sEbyj70rFWsafJpZW56EZJirytFNqhJNELfRDMOO+I X-Received: by 2002:a37:9481:: with SMTP id w123mr56257096qkd.319.1560506523979; Fri, 14 Jun 2019 03:02:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560506523; cv=none; d=google.com; s=arc-20160816; b=GHr9X69atB4knkjMrbbjU43hTTjC2nNhxxTtTGF1/86t093lQdsMKguXaRu5NEieDv GIniSzwCYTBpYfvPuo+fp//diiJbIAHhPItSRaIdWoEDf4TcSiisW/kH4Rt1oiQeTZDz gUYtVKnci9NA6I3d1oKHirjbYH2Bp/cxKVYV4FE4fb/KFwzQPVmpkTZ4tHZ53UmrR6iy qd8tfyIMHf/gyVfVy5baUJgPx0Aws3TRGkpRlnmBN6qQxwkAZjm8nn51Dpwmx84agmuw iy99oGkGrIq1kkkCDDn2alNMUq4prgQutKF7K5a3AJZGssXS83N7Lpw9tuZK+HJD/c1o f+UQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=2BnEF5DjEUXKUN68Cu5GloZzc1NrCiCe4crz0f6bDtE=; b=0O/NUJ8l71UgWkFqKOREh70Hxz25zj9UX+DISbL7UnPZg5z5pueyGx8liABUb8EzfU WIBzhm9WfPXRKtisvJJ6T/BTU1+Hh8+547X5i+jnv2+468OYsEPjSfWCSdKXFG4CZCEn VecpkUZ3nmCS8ZU0ZGyTNSkiVENGm+Hdipo7UKN4NQ2Y9+QJEE1UYClOz+TnEAjUglVX 1xOWF0CG7xGdCGpRPc2tK69DY1hUMqYm/zbkVq+58tTyS4bsTyd/GcJxToD5Z/V2Mzy6 gGIFDOTDApj0/ItXP1rm0dOaGO2hzbaD2Q73CUVdtScns6ezxTrg/9vWDzXX13y/rERK rXlA== 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 e6si1468964qkg.171.2019.06.14.03.02.03 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 14 Jun 2019 03:02:03 -0700 (PDT) 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-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A926B308FF30; Fri, 14 Jun 2019 10:01:47 +0000 (UTC) Received: from t460s.redhat.com (ovpn-116-252.ams2.redhat.com [10.36.116.252]) by smtp.corp.redhat.com (Postfix) with ESMTP id B7A305D9D2; Fri, 14 Jun 2019 10:01:42 +0000 (UTC) From: David Hildenbrand To: linux-kernel@vger.kernel.org Cc: Dan Williams , Andrew Morton , linuxppc-dev@lists.ozlabs.org, linux-acpi@vger.kernel.org, linux-mm@kvack.org, David Hildenbrand , Greg Kroah-Hartman , "Rafael J. Wysocki" Subject: [PATCH v1 2/6] drivers/base/memory: Use "unsigned long" for block ids Date: Fri, 14 Jun 2019 12:01:10 +0200 Message-Id: <20190614100114.311-3-david@redhat.com> In-Reply-To: <20190614100114.311-1-david@redhat.com> References: <20190614100114.311-1-david@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Fri, 14 Jun 2019 10:01:52 +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 Block ids are just shifted section numbers, so let's also use "unsigned long" for them, too. Cc: Greg Kroah-Hartman Cc: "Rafael J. Wysocki" Signed-off-by: David Hildenbrand --- drivers/base/memory.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/base/memory.c b/drivers/base/memory.c index 5b3a2fd250ba..3ed08e67e64f 100644 --- a/drivers/base/memory.c +++ b/drivers/base/memory.c @@ -34,12 +34,12 @@ static DEFINE_MUTEX(mem_sysfs_mutex); static int sections_per_block; -static inline int base_memory_block_id(unsigned long section_nr) +static inline unsigned long base_memory_block_id(unsigned long section_nr) { return section_nr / sections_per_block; } -static inline int pfn_to_block_id(unsigned long pfn) +static inline unsigned long pfn_to_block_id(unsigned long pfn) { return base_memory_block_id(pfn_to_section_nr(pfn)); } @@ -587,7 +587,7 @@ int __weak arch_get_memory_phys_device(unsigned long start_pfn) * A reference for the returned object is held and the reference for the * hinted object is released. */ -static struct memory_block *find_memory_block_by_id(int block_id, +static struct memory_block *find_memory_block_by_id(unsigned long block_id, struct memory_block *hint) { struct device *hintdev = hint ? &hint->dev : NULL; @@ -604,7 +604,7 @@ static struct memory_block *find_memory_block_by_id(int block_id, struct memory_block *find_memory_block_hinted(struct mem_section *section, struct memory_block *hint) { - int block_id = base_memory_block_id(__section_nr(section)); + unsigned long block_id = base_memory_block_id(__section_nr(section)); return find_memory_block_by_id(block_id, hint); } @@ -663,8 +663,8 @@ int register_memory(struct memory_block *memory) return ret; } -static int init_memory_block(struct memory_block **memory, int block_id, - unsigned long state) +static int init_memory_block(struct memory_block **memory, + unsigned long block_id, unsigned long state) { struct memory_block *mem; unsigned long start_pfn; @@ -730,8 +730,8 @@ static void unregister_memory(struct memory_block *memory) */ int create_memory_block_devices(unsigned long start, unsigned long size) { - const int start_block_id = pfn_to_block_id(PFN_DOWN(start)); - int end_block_id = pfn_to_block_id(PFN_DOWN(start + size)); + const unsigned long start_block_id = pfn_to_block_id(PFN_DOWN(start)); + unsigned long end_block_id = pfn_to_block_id(PFN_DOWN(start + size)); struct memory_block *mem; unsigned long block_id; int ret = 0; @@ -767,10 +767,10 @@ int create_memory_block_devices(unsigned long start, unsigned long size) */ void remove_memory_block_devices(unsigned long start, unsigned long size) { - const int start_block_id = pfn_to_block_id(PFN_DOWN(start)); - const int end_block_id = pfn_to_block_id(PFN_DOWN(start + size)); + const unsigned long start_block_id = pfn_to_block_id(PFN_DOWN(start)); + const unsigned long end_block_id = pfn_to_block_id(PFN_DOWN(start + size)); struct memory_block *mem; - int block_id; + unsigned long block_id; if (WARN_ON_ONCE(!IS_ALIGNED(start, memory_block_size_bytes()) || !IS_ALIGNED(size, memory_block_size_bytes()))) From patchwork Fri Jun 14 10:01:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 10994939 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 D6C4B13AF for ; Fri, 14 Jun 2019 10:01:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C7CF5283BF for ; Fri, 14 Jun 2019 10:01:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C596E283CA; Fri, 14 Jun 2019 10:01:56 +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 autolearn=unavailable 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 5B059283BF for ; Fri, 14 Jun 2019 10:01:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1F9BD6B000D; Fri, 14 Jun 2019 06:01:55 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 18D856B0266; Fri, 14 Jun 2019 06:01:55 -0400 (EDT) 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 049CE6B000E; Fri, 14 Jun 2019 06:01:54 -0400 (EDT) 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 D41AA6B000A for ; Fri, 14 Jun 2019 06:01:54 -0400 (EDT) Received: by mail-qk1-f200.google.com with SMTP id d62so1567166qke.21 for ; Fri, 14 Jun 2019 03:01:54 -0700 (PDT) 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:in-reply-to:references:mime-version :content-transfer-encoding; bh=CgJcDDtOoRdyVXX+iicAe9GvZqRRuW9//gwRK0vdIho=; b=K/1bfhVf5+BFD5O0/PBFoOWvxyIf0zaa8iQVNU1VD3e5ApRrXLGVSVWDwOivEEyakO kMYN3dr9umjsEzJ1Hbw7BPcM5XFawKP8S2eDc+s444z9e6dQ/lrSsO/Ke0jSDjDXVIXB c1/CwzhsUD86rSxZp2wiV1MmjkCosaOHlOg0ZLpJx3i3IibJXjJ3BFLMQWyquAUJaeYC RxTDPoApr9L/eppTyEa/eLF8q9KWWm6xZ+yQPWm/Ohgy1x3KaeKp9V6JZ00Qse7se8rK kjmI8Z1S8lrMfCnQGViZCtAcnfgms3pQ4jTT20oNalHYPm8zCIDb0aeh78rUhChLxbfN Kp4g== 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: APjAAAWC8/dHbZZMd4YAPPN0h2mgDhAKEmKKiKTMV8LqzKI++nZ77MCs 66Vpk+icArpZA3Gp+wBkEQeKDRhVcxPFl2zMGTfzVRYs1KbvcpOghfPpexYQhpcz2AgVbqbHPBY 5Ya9+3Gm8qlZlQcg73X/BqkLHXQQE/sMhoH1Kd6XOwmWjp+n/+EcqY5DOfkRjG2Bxng== X-Received: by 2002:a0c:d40d:: with SMTP id t13mr7467051qvh.175.1560506514614; Fri, 14 Jun 2019 03:01:54 -0700 (PDT) X-Google-Smtp-Source: APXvYqwSNszPF9q9Zz6qGqfUlctBXIvdUGYAlNJ0Z3NoMyxdzGEeAny4oxykKLI+iHrT5aWHshES X-Received: by 2002:a0c:d40d:: with SMTP id t13mr7466967qvh.175.1560506513545; Fri, 14 Jun 2019 03:01:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560506513; cv=none; d=google.com; s=arc-20160816; b=l4j2Bj2neEvhyL4p/J9ZTAZf/iUb91fUWCePPoO4WQSCCfgG62TYTwu9RATRoLE5+Z QIEtpEmrDiv2072ZjfF2cRiswpyq+BnuLU1Gqtihz+iwYNuuz56jDzzwaFdXMo4Au2r9 cLOkvlxqA5xbOzq6Uj0RNBLR/r02l2feBQSikOo135BK9R/muuc9aT7TDOE32on+LWk5 4J2PGZrRGbYxxieARc6XXTFvBne6NhlWrJekx6S9b2jhnEKzpqfo93VqHJpH83GOiJXK tClNYxEydzE4zeNGP7Ux2XpOvexPrgPgEk86lds9uyIsq5HG5LIAre7IEIarpl3yaJ7J 5ftw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=CgJcDDtOoRdyVXX+iicAe9GvZqRRuW9//gwRK0vdIho=; b=tqEX5hZlcGoasbattxKueeskZwQfQ3YiVNOsmDP/uv4S0s0C3D7xsIAFLudvNhx7qp s+YAzn20PidHpT5NjEqPqfka2i6ok6UlUWPo1JISNJM2lMUQZCuxjd26pXu429a80y4M Veiy9oolT/K8ilxnzKpIQbygXkGniDQ9JaNM7FNNuCgH5Bn/MZzpPPVibh2rnZSQyupk IHmVNy7Q0A4pWCorzLUwLNe7HvKYRgtyy6S4q6TvJil9jcIDu+/MuWpFgQJ8RYAk3rJm QrAju/53i6hyahHU2/EVxRPG/Tq35jLIOlp8O2LokJZJWvK8vsvf+LO/K6YuVh7bqJl/ nu5g== 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 q1si1489835qkd.157.2019.06.14.03.01.53 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 14 Jun 2019 03:01:53 -0700 (PDT) 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-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 264D581F07; Fri, 14 Jun 2019 10:01:50 +0000 (UTC) Received: from t460s.redhat.com (ovpn-116-252.ams2.redhat.com [10.36.116.252]) by smtp.corp.redhat.com (Postfix) with ESMTP id 05D8D5DD7A; Fri, 14 Jun 2019 10:01:47 +0000 (UTC) From: David Hildenbrand To: linux-kernel@vger.kernel.org Cc: Dan Williams , Andrew Morton , linuxppc-dev@lists.ozlabs.org, linux-acpi@vger.kernel.org, linux-mm@kvack.org, David Hildenbrand , Greg Kroah-Hartman , "Rafael J. Wysocki" , Keith Busch , Oscar Salvador Subject: [PATCH v1 3/6] mm: Make register_mem_sect_under_node() static Date: Fri, 14 Jun 2019 12:01:11 +0200 Message-Id: <20190614100114.311-4-david@redhat.com> In-Reply-To: <20190614100114.311-1-david@redhat.com> References: <20190614100114.311-1-david@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Fri, 14 Jun 2019 10:01:50 +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 It is only used internally. Cc: Greg Kroah-Hartman Cc: "Rafael J. Wysocki" Cc: Andrew Morton Cc: Keith Busch Cc: Oscar Salvador Signed-off-by: David Hildenbrand --- drivers/base/node.c | 3 ++- include/linux/node.h | 7 ------- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/drivers/base/node.c b/drivers/base/node.c index 9be88fd05147..e6364e3e3e31 100644 --- a/drivers/base/node.c +++ b/drivers/base/node.c @@ -752,7 +752,8 @@ static int __ref get_nid_for_pfn(unsigned long pfn) } /* register memory section under specified node if it spans that node */ -int register_mem_sect_under_node(struct memory_block *mem_blk, void *arg) +static int register_mem_sect_under_node(struct memory_block *mem_blk, + void *arg) { int ret, nid = *(int *)arg; unsigned long pfn, sect_start_pfn, sect_end_pfn; diff --git a/include/linux/node.h b/include/linux/node.h index 548c226966a2..4866f32a02d8 100644 --- a/include/linux/node.h +++ b/include/linux/node.h @@ -137,8 +137,6 @@ static inline int register_one_node(int nid) extern void unregister_one_node(int nid); extern int register_cpu_under_node(unsigned int cpu, unsigned int nid); extern int unregister_cpu_under_node(unsigned int cpu, unsigned int nid); -extern int register_mem_sect_under_node(struct memory_block *mem_blk, - void *arg); extern void unregister_memory_block_under_nodes(struct memory_block *mem_blk); extern int register_memory_node_under_compute_node(unsigned int mem_nid, @@ -170,11 +168,6 @@ static inline int unregister_cpu_under_node(unsigned int cpu, unsigned int nid) { return 0; } -static inline int register_mem_sect_under_node(struct memory_block *mem_blk, - void *arg) -{ - return 0; -} static inline void unregister_memory_block_under_nodes(struct memory_block *mem_blk) { } From patchwork Fri Jun 14 10:01:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 10994951 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 29DA213AF for ; Fri, 14 Jun 2019 10:02:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1AD7D283CA for ; Fri, 14 Jun 2019 10:02:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0EEA2283C5; Fri, 14 Jun 2019 10:02:07 +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 autolearn=unavailable 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 39A87283B2 for ; Fri, 14 Jun 2019 10:02:06 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 15C466B0266; Fri, 14 Jun 2019 06:02:05 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 0EB496B0269; Fri, 14 Jun 2019 06:02:05 -0400 (EDT) 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 E2DB86B026A; Fri, 14 Jun 2019 06:02:04 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-qt1-f199.google.com (mail-qt1-f199.google.com [209.85.160.199]) by kanga.kvack.org (Postfix) with ESMTP id BBB676B0266 for ; Fri, 14 Jun 2019 06:02:04 -0400 (EDT) Received: by mail-qt1-f199.google.com with SMTP id p43so1616530qtk.23 for ; Fri, 14 Jun 2019 03:02:04 -0700 (PDT) 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:in-reply-to:references:mime-version :content-transfer-encoding; bh=VMeP8L/qWslV2jjlEW9DSGEVWMFsOcD8qyH3nOU1iUI=; b=AuLtyKqyFh+RpUP/EObvufpM+hfOj2UVJEZYaFLzyqp/V48GsMb1eRCUm+2R8cXKqE v8MsHEyfLh7BpIqVpV2w+yqXOj7Ibf89e4yP8HQLBzMpTHL6TZtcZKiqnsjZ3nxyI3wz ibbTGlylf+0Ze+jGKG1OOKihbApIuTZjf8wdbputmsDgpGrkQK3zb8Z0wlPPV6l59lAO AJHoh3qMIsXwZHZyohl5Dk7R6ytxxI9LhZbNqTDukYcn40FAkHe6+PCppFBsGX+/QWIB 4OSHrqTquiG3kiG+fO1c+xTabMImylYEHNT0/DazpEnWx6dfdSDKYsDbnKhWyrBIUoNl aABA== 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: APjAAAWXj2yOrXn58MgSY5V4G1nJhsB1JSMRzWC6dHG0BVNmcOOoijbp GQEdjakVkrbwAOkbxgdzkr6jAidNjI7jOo3j/dWHSMMrzoi32O2VMpaqwpe/F9Ytox6ZcagdIDP BvJubK4QwKamNS7DZrNH6/BjvtPSOmzL/vB7kxc0yVHI7E6+SwFVtAsPtaTigmtIE2A== X-Received: by 2002:ac8:1acf:: with SMTP id h15mr79535809qtk.67.1560506524423; Fri, 14 Jun 2019 03:02:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqwCFRHPFkNTrRbmFlE9ZjmaKGxeXaUgJuVCCxpQEvSczXK6ANUiGAUee8HVZrUC8oEbFi6u X-Received: by 2002:ac8:1acf:: with SMTP id h15mr79535687qtk.67.1560506523228; Fri, 14 Jun 2019 03:02:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560506523; cv=none; d=google.com; s=arc-20160816; b=fdKI+fD1uP2PFJ67bLKhW1kJT8CQ1kgCOwsT5yrTxQZ+5YOodu32lojPgYx1Q2wrg/ 4GCCet3wHKceYJf4f8JnIM2HyfGp6odITBCzlHhub2q9I3vthqNNroItH1BGfDg8nmoh 0BDW4fanRHXzT4K++S3CZRH1mtDBivXRq0HNIOL9mbEqJ4L/rlX+a1dZ4JoMvOiKZAIb xA+wXl+nsl/sJHGmokGKrEpmHHf6kl1iryZwJmWMujN51ercJ5WRmaudiLynz0TzJyJE wnqQ53J8UZQDUKkNQvJbmpQJO259PZpRErN0+5eNUYtyivBOpOt1rqrI1750mepkduZq WD2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=VMeP8L/qWslV2jjlEW9DSGEVWMFsOcD8qyH3nOU1iUI=; b=EvekkwekChl7PV3zSG4OGTNG52mM/Mly4TX59w/tno89Qd53s/5RbHcHulmzQGzwbZ mbwR7g7UJZHyfOqxQMx+J5tL7KaW0nOAn/ApmrG0RsUIHT643DZiirZLTNynPBdY0E0Q ZifW50BcPwc410XgFsvopgo3caN9ngu2NRwgKKhfjERxcUtUOlJxDpTWkcBGzZi0+BOV cUmwdWt0q+4CUbcPeAumZpal96IeXLtUF3gFC8NB+MpDoUtQEejlxquHZVnrfmzOdJBf 9+0qItQvzJwoLlPRdoANA7DMaCXClCH5CAerdw+GzLuNn3jjs3W4mp2xdR/AAjwTRgbF Vy8A== 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 q63si1563294qke.226.2019.06.14.03.02.03 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 14 Jun 2019 03:02:03 -0700 (PDT) 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-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 12E6881F13; Fri, 14 Jun 2019 10:01:58 +0000 (UTC) Received: from t460s.redhat.com (ovpn-116-252.ams2.redhat.com [10.36.116.252]) by smtp.corp.redhat.com (Postfix) with ESMTP id 75BB15DD7A; Fri, 14 Jun 2019 10:01:50 +0000 (UTC) From: David Hildenbrand To: linux-kernel@vger.kernel.org Cc: Dan Williams , Andrew Morton , linuxppc-dev@lists.ozlabs.org, linux-acpi@vger.kernel.org, linux-mm@kvack.org, David Hildenbrand , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , "Rafael J. Wysocki" , Len Brown , Greg Kroah-Hartman , Rashmica Gupta , Pavel Tatashin , Anshuman Khandual , Michael Neuling , Thomas Gleixner , Oscar Salvador , Michal Hocko , Wei Yang , Juergen Gross , Qian Cai , Arun KS Subject: [PATCH v1 4/6] mm/memory_hotplug: Rename walk_memory_range() and pass start+size instead of pfns Date: Fri, 14 Jun 2019 12:01:12 +0200 Message-Id: <20190614100114.311-5-david@redhat.com> In-Reply-To: <20190614100114.311-1-david@redhat.com> References: <20190614100114.311-1-david@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Fri, 14 Jun 2019 10:02:02 +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 walk_memory_range() was once used to iterate over sections. Now, it iterates over memory blocks. Rename the function, fixup the documentation. Also, pass start+size instead of PFNs, which is what most callers already have at hand. (we'll rework link_mem_sections() most probably soon) Follow-up patches wil rework, simplify, and move walk_memory_blocks() to drivers/base/memory.c. Note: walk_memory_blocks() only works correctly right now if the start_pfn is aligned to a section start. This is the case right now, but we'll generalize the function in a follow up patch so the semantics match the documentation. Cc: Benjamin Herrenschmidt Cc: Paul Mackerras Cc: Michael Ellerman Cc: "Rafael J. Wysocki" Cc: Len Brown Cc: Greg Kroah-Hartman Cc: David Hildenbrand Cc: Rashmica Gupta Cc: Andrew Morton Cc: Pavel Tatashin Cc: Anshuman Khandual Cc: Michael Neuling Cc: Thomas Gleixner Cc: Oscar Salvador Cc: Michal Hocko Cc: Wei Yang Cc: Juergen Gross Cc: Qian Cai Cc: Arun KS Signed-off-by: David Hildenbrand --- arch/powerpc/platforms/powernv/memtrace.c | 22 ++++++++++----------- drivers/acpi/acpi_memhotplug.c | 19 ++++-------------- drivers/base/node.c | 5 +++-- include/linux/memory_hotplug.h | 2 +- mm/memory_hotplug.c | 24 ++++++++++++----------- 5 files changed, 32 insertions(+), 40 deletions(-) diff --git a/arch/powerpc/platforms/powernv/memtrace.c b/arch/powerpc/platforms/powernv/memtrace.c index 5e53c1392d3b..8c82c041afe6 100644 --- a/arch/powerpc/platforms/powernv/memtrace.c +++ b/arch/powerpc/platforms/powernv/memtrace.c @@ -70,23 +70,24 @@ static int change_memblock_state(struct memory_block *mem, void *arg) /* called with device_hotplug_lock held */ static bool memtrace_offline_pages(u32 nid, u64 start_pfn, u64 nr_pages) { + const unsigned long start = PFN_PHYS(start_pfn); + const unsigned long size = PFN_PHYS(nr_pages); u64 end_pfn = start_pfn + nr_pages - 1; - if (walk_memory_range(start_pfn, end_pfn, NULL, - check_memblock_online)) + if (walk_memory_blocks(start, size, NULL, check_memblock_online)) return false; - walk_memory_range(start_pfn, end_pfn, (void *)MEM_GOING_OFFLINE, - change_memblock_state); + walk_memory_blocks(start, size, (void *)MEM_GOING_OFFLINE, + change_memblock_state); if (offline_pages(start_pfn, nr_pages)) { - walk_memory_range(start_pfn, end_pfn, (void *)MEM_ONLINE, - change_memblock_state); + walk_memory_blocks(start, size, (void *)MEM_ONLINE, + change_memblock_state); return false; } - walk_memory_range(start_pfn, end_pfn, (void *)MEM_OFFLINE, - change_memblock_state); + walk_memory_blocks(start, size, (void *)MEM_OFFLINE, + change_memblock_state); return true; @@ -242,9 +243,8 @@ static int memtrace_online(void) */ if (!memhp_auto_online) { lock_device_hotplug(); - walk_memory_range(PFN_DOWN(ent->start), - PFN_UP(ent->start + ent->size - 1), - NULL, online_mem_block); + walk_memory_blocks(ent->start, ent->size, NULL, + online_mem_block); unlock_device_hotplug(); } diff --git a/drivers/acpi/acpi_memhotplug.c b/drivers/acpi/acpi_memhotplug.c index db013dc21c02..e294f44a7850 100644 --- a/drivers/acpi/acpi_memhotplug.c +++ b/drivers/acpi/acpi_memhotplug.c @@ -155,16 +155,6 @@ static int acpi_memory_check_device(struct acpi_memory_device *mem_device) return 0; } -static unsigned long acpi_meminfo_start_pfn(struct acpi_memory_info *info) -{ - return PFN_DOWN(info->start_addr); -} - -static unsigned long acpi_meminfo_end_pfn(struct acpi_memory_info *info) -{ - return PFN_UP(info->start_addr + info->length-1); -} - static int acpi_bind_memblk(struct memory_block *mem, void *arg) { return acpi_bind_one(&mem->dev, arg); @@ -173,9 +163,8 @@ static int acpi_bind_memblk(struct memory_block *mem, void *arg) static int acpi_bind_memory_blocks(struct acpi_memory_info *info, struct acpi_device *adev) { - return walk_memory_range(acpi_meminfo_start_pfn(info), - acpi_meminfo_end_pfn(info), adev, - acpi_bind_memblk); + return walk_memory_blocks(info->start_addr, info->length, adev, + acpi_bind_memblk); } static int acpi_unbind_memblk(struct memory_block *mem, void *arg) @@ -186,8 +175,8 @@ static int acpi_unbind_memblk(struct memory_block *mem, void *arg) static void acpi_unbind_memory_blocks(struct acpi_memory_info *info) { - walk_memory_range(acpi_meminfo_start_pfn(info), - acpi_meminfo_end_pfn(info), NULL, acpi_unbind_memblk); + walk_memory_blocks(info->start_addr, info->length, NULL, + acpi_unbind_memblk); } static int acpi_memory_enable_device(struct acpi_memory_device *mem_device) diff --git a/drivers/base/node.c b/drivers/base/node.c index e6364e3e3e31..d8c02e65df68 100644 --- a/drivers/base/node.c +++ b/drivers/base/node.c @@ -833,8 +833,9 @@ void unregister_memory_block_under_nodes(struct memory_block *mem_blk) int link_mem_sections(int nid, unsigned long start_pfn, unsigned long end_pfn) { - return walk_memory_range(start_pfn, end_pfn, (void *)&nid, - register_mem_sect_under_node); + return walk_memory_blocks(PFN_PHYS(start_pfn), + PFN_PHYS(end_pfn - start_pfn), (void *)&nid, + register_mem_sect_under_node); } #ifdef CONFIG_HUGETLBFS diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h index 79e0add6a597..d9fffc34949f 100644 --- a/include/linux/memory_hotplug.h +++ b/include/linux/memory_hotplug.h @@ -340,7 +340,7 @@ static inline void __remove_memory(int nid, u64 start, u64 size) {} #endif /* CONFIG_MEMORY_HOTREMOVE */ extern void __ref free_area_init_core_hotplug(int nid); -extern int walk_memory_range(unsigned long start_pfn, unsigned long end_pfn, +extern int walk_memory_blocks(unsigned long start, unsigned long size, 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); diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index a88c5f334e5a..122a7d31efdd 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c @@ -1126,8 +1126,7 @@ int __ref add_memory_resource(int nid, struct resource *res) /* online pages if requested */ if (memhp_auto_online) - walk_memory_range(PFN_DOWN(start), PFN_UP(start + size - 1), - NULL, online_memory_block); + walk_memory_blocks(start, size, NULL, online_memory_block); return ret; error: @@ -1665,20 +1664,24 @@ int offline_pages(unsigned long start_pfn, unsigned long nr_pages) #endif /* CONFIG_MEMORY_HOTREMOVE */ /** - * walk_memory_range - walks through all mem sections in [start_pfn, end_pfn) - * @start_pfn: start pfn of the memory range - * @end_pfn: end pfn of the memory range + * walk_memory_blocks - walk through all present memory blocks overlapped + * by the range [start, start + size) + * + * @start: start address of the memory range + * @size: size of the memory range * @arg: argument passed to func - * @func: callback for each memory section walked + * @func: callback for each memory block walked * - * This function walks through all present mem sections in range - * [start_pfn, end_pfn) and call func on each mem section. + * This function walks through all present memory blocks overlapped by the + * range [start, start + size), calling func on each memory block. * * Returns the return value of func. */ -int walk_memory_range(unsigned long start_pfn, unsigned long end_pfn, +int walk_memory_blocks(unsigned long start, unsigned long size, void *arg, int (*func)(struct memory_block *, void *)) { + const unsigned long start_pfn = PFN_DOWN(start); + const unsigned long end_pfn = PFN_UP(start + size - 1); struct memory_block *mem = NULL; struct mem_section *section; unsigned long pfn, section_nr; @@ -1824,8 +1827,7 @@ static int __ref try_remove_memory(int nid, u64 start, u64 size) * whether all memory blocks in question are offline and return error * if this is not the case. */ - rc = walk_memory_range(PFN_DOWN(start), PFN_UP(start + size - 1), NULL, - check_memblock_offlined_cb); + rc = walk_memory_blocks(start, size, NULL, check_memblock_offlined_cb); if (rc) goto done; From patchwork Fri Jun 14 10:01:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 10994957 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 6053B14E5 for ; Fri, 14 Jun 2019 10:02:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 52405283EE for ; Fri, 14 Jun 2019 10:02:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 43C9B21EEB; Fri, 14 Jun 2019 10:02:12 +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 autolearn=unavailable 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 7E6F5283BF for ; Fri, 14 Jun 2019 10:02:11 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B99196B026A; Fri, 14 Jun 2019 06:02:06 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id AF9956B026B; Fri, 14 Jun 2019 06:02:06 -0400 (EDT) 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 8DA4B6B026C; Fri, 14 Jun 2019 06:02:06 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-qt1-f200.google.com (mail-qt1-f200.google.com [209.85.160.200]) by kanga.kvack.org (Postfix) with ESMTP id 610756B026A for ; Fri, 14 Jun 2019 06:02:06 -0400 (EDT) Received: by mail-qt1-f200.google.com with SMTP id 97so1637343qtb.16 for ; Fri, 14 Jun 2019 03:02:06 -0700 (PDT) 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:in-reply-to:references:mime-version :content-transfer-encoding; bh=8beaQMFwpJ6c53GpurRpIxP2Wr3rBHKJiUyn04aQEBg=; b=AcM6on231C7uNPVPjoKr0gcsE9XZCSEjKOCo5LjoVy8/uRT6HkF23LVb3QB6NchTFE eH8+Plc9M2dEFSuQ6iKz0zbJnHY1/jwSIpK5HvCsy6WN+wpOfEenxQ0m0PzwDE868v3Z AWBj8U8omc5Hefxx3Nk2W1HpqJgJgM+Uzqs9gsyDEf/ZOhU3uvFu7pg2JiYx06+Xq05P S1iyt6gT+XnHnVWq136wH6ePsnyD4/whJQAHkO1W5ULAMdutvirC49EQTb8s3pQDSbug 9kOiWb1FyGsaVeRj0ji7H5ddhr2Z4wuR12VY1VVEAGSsHgucviKkFp0vZN59UKfnNEWy Wrmw== 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: APjAAAWMQkL2WhN/cSJcIow7xEvPxpGV9ut7O/nWVVW+kSo054UytbRj ASPZAZcHK1zPji4E/lNoASdMIk/IuVDKgDAJhbM9e842p9ujP32RqjnkMZzL/pD2dGfeXfKHPoR 6Xbg/zo1Y90P4SwFjjqU/5Ng6O2VR3IxWuIK2E2rTeTqvvgPTS1z2Lci78tpf9AwJkg== X-Received: by 2002:ac8:c0e:: with SMTP id k14mr36843537qti.72.1560506526120; Fri, 14 Jun 2019 03:02:06 -0700 (PDT) X-Google-Smtp-Source: APXvYqz6xJKq95oeY3apNKlyDL96xYG763VweViZ4k6wp+WhVegSQ1HsQC4ND6tMWeMyKARoHgae X-Received: by 2002:ac8:c0e:: with SMTP id k14mr36843442qti.72.1560506525034; Fri, 14 Jun 2019 03:02:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560506525; cv=none; d=google.com; s=arc-20160816; b=cEut/svJf4avDc7GHibUo6TpqyHEjN0LDKmBWe3ce/XUW/hHeQNg1foWAu1FOkV+z7 Mpm8MpC5Aci1HFQqybIFjTgfLc/zGxL63D66BEk7kFtBxjf0mnbqaf7cpfxrquy9wHno KBo2Xf1sOkfhmeEx6B5pYMXgmMMAy+q1csRzLPqV5Oa2qlHAFBac+KOiSfgqbewL+7D0 a5Z07qC47WmAbaeGtZyNMbxMj71oHy+FGY6avboP/1DSGjQzLOr0Ybnpug1T26oRAIZi fyVUPdUeQ1D6+E1T029sQ+Aa0/U414zkmnn5KrRM/eS4sPGaLEIY6GjID2j5NPBSelii NRKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=8beaQMFwpJ6c53GpurRpIxP2Wr3rBHKJiUyn04aQEBg=; b=L4zNZyKPdOeRl9yJjV8u4cMGIlTpPN1BiOAL06uP/PX/r52xHQRJxw1mWpAqW45Whx 5Zn6C1R2i10FtoOC17eCMZm89ryKS1wteQX+Mowzn2gb05Y+JPApEPWRkvi63vG15B7B M1XfeLc05GkX+I0CSgnuDGM1zzN1VnhAuH/2yO4oTPnPm8TqO8u1tUPlmCvi4TOvGEDO oDFHS0EDoEMPg4Oo2KwlQBuI1uhYy+afUdcIpvLuk4AsA7biPxcU5j0ekhwse/W296iJ ckrTsPEmzAllDdXGaP+UbpZeVfR3Kxv8JSGsGkDkh22gJxuogHNqsbjm5oCXg5kqKJdK o2+g== 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 x127si1466911qka.104.2019.06.14.03.02.04 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 14 Jun 2019 03:02:05 -0700 (PDT) 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-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0BF8C3082E64; Fri, 14 Jun 2019 10:02:04 +0000 (UTC) Received: from t460s.redhat.com (ovpn-116-252.ams2.redhat.com [10.36.116.252]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5FB715D9C3; Fri, 14 Jun 2019 10:01:58 +0000 (UTC) From: David Hildenbrand To: linux-kernel@vger.kernel.org Cc: Dan Williams , Andrew Morton , linuxppc-dev@lists.ozlabs.org, linux-acpi@vger.kernel.org, linux-mm@kvack.org, David Hildenbrand , Greg Kroah-Hartman , "Rafael J. Wysocki" , Stephen Rothwell , Pavel Tatashin , Andrew Banman , "mike.travis@hpe.com" , Oscar Salvador , Michal Hocko , Wei Yang , Arun KS , Qian Cai Subject: [PATCH v1 5/6] mm/memory_hotplug: Move and simplify walk_memory_blocks() Date: Fri, 14 Jun 2019 12:01:13 +0200 Message-Id: <20190614100114.311-6-david@redhat.com> In-Reply-To: <20190614100114.311-1-david@redhat.com> References: <20190614100114.311-1-david@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Fri, 14 Jun 2019 10:02:04 +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 Let's move walk_memory_blocks() to the place where memory block logic resides and simplify it. While at it, add a type for the callback function. Cc: Greg Kroah-Hartman Cc: "Rafael J. Wysocki" Cc: David Hildenbrand Cc: Andrew Morton Cc: Stephen Rothwell Cc: Pavel Tatashin Cc: Andrew Banman Cc: "mike.travis@hpe.com" Cc: Oscar Salvador Cc: Michal Hocko Cc: Wei Yang Cc: Arun KS Cc: Qian Cai Signed-off-by: David Hildenbrand --- drivers/base/memory.c | 42 ++++++++++++++++++++++++++ include/linux/memory.h | 3 ++ include/linux/memory_hotplug.h | 2 -- mm/memory_hotplug.c | 55 ---------------------------------- 4 files changed, 45 insertions(+), 57 deletions(-) diff --git a/drivers/base/memory.c b/drivers/base/memory.c index 3ed08e67e64f..4f2e2f3b3d78 100644 --- a/drivers/base/memory.c +++ b/drivers/base/memory.c @@ -44,6 +44,11 @@ static inline unsigned long pfn_to_block_id(unsigned long pfn) return base_memory_block_id(pfn_to_section_nr(pfn)); } +static inline unsigned long phys_to_block_id(unsigned long phys) +{ + return pfn_to_block_id(PFN_DOWN(phys)); +} + static int memory_subsys_online(struct device *dev); static int memory_subsys_offline(struct device *dev); @@ -853,3 +858,40 @@ int __init memory_dev_init(void) printk(KERN_ERR "%s() failed: %d\n", __func__, ret); return ret; } + +/** + * walk_memory_blocks - walk through all present memory blocks overlapped + * by the range [start, start + size) + * + * @start: start address of the memory range + * @size: size of the memory range + * @arg: argument passed to func + * @func: callback for each memory section walked + * + * This function walks through all present memory blocks overlapped by the + * range [start, start + size), calling func on each memory block. + * + * In case func() returns an error, walking is aborted and the error is + * returned. + */ +int walk_memory_blocks(unsigned long start, unsigned long size, + void *arg, walk_memory_blocks_func_t func) +{ + const unsigned long start_block_id = phys_to_block_id(start); + const unsigned long end_block_id = phys_to_block_id(start + size - 1); + struct memory_block *mem; + unsigned long block_id; + int ret = 0; + + for (block_id = start_block_id; block_id <= end_block_id; block_id++) { + mem = find_memory_block_by_id(block_id, NULL); + if (!mem) + continue; + + ret = func(mem, arg); + put_device(&mem->dev); + if (ret) + break; + } + return ret; +} diff --git a/include/linux/memory.h b/include/linux/memory.h index f26a5417ec5d..b3b388775a30 100644 --- a/include/linux/memory.h +++ b/include/linux/memory.h @@ -119,6 +119,9 @@ extern int memory_isolate_notify(unsigned long val, void *v); extern struct memory_block *find_memory_block_hinted(struct mem_section *, struct memory_block *); extern struct memory_block *find_memory_block(struct mem_section *); +typedef int (*walk_memory_blocks_func_t)(struct memory_block *, void *); +extern int walk_memory_blocks(unsigned long start, unsigned long size, + void *arg, walk_memory_blocks_func_t func); #define CONFIG_MEM_BLOCK_SIZE (PAGES_PER_SECTION<= mem->start_section_nr) && - (section_nr <= mem->end_section_nr)) - continue; - - mem = find_memory_block_hinted(section, mem); - if (!mem) - continue; - - ret = func(mem, arg); - if (ret) { - kobject_put(&mem->dev.kobj); - return ret; - } - } - - if (mem) - kobject_put(&mem->dev.kobj); - - return 0; -} - -#ifdef CONFIG_MEMORY_HOTREMOVE static int check_memblock_offlined_cb(struct memory_block *mem, void *arg) { int ret = !is_memblock_offlined(mem); From patchwork Fri Jun 14 10:01:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 10994959 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 78B0013AF for ; Fri, 14 Jun 2019 10:02:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 68F53205FD for ; Fri, 14 Jun 2019 10:02:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5C42C28415; Fri, 14 Jun 2019 10:02:15 +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 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 CF46B283B2 for ; Fri, 14 Jun 2019 10:02:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 385636B026B; Fri, 14 Jun 2019 06:02:13 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 30E1F6B026C; Fri, 14 Jun 2019 06:02:13 -0400 (EDT) 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 136756B026D; Fri, 14 Jun 2019 06:02:13 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-qt1-f199.google.com (mail-qt1-f199.google.com [209.85.160.199]) by kanga.kvack.org (Postfix) with ESMTP id E33116B026B for ; Fri, 14 Jun 2019 06:02:12 -0400 (EDT) Received: by mail-qt1-f199.google.com with SMTP id r58so1673803qtb.5 for ; Fri, 14 Jun 2019 03:02:12 -0700 (PDT) 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:in-reply-to:references:mime-version :content-transfer-encoding; bh=GGbrHuVMDrkQm8Ggah1IohNNECSG1loyCUoeL7DCwug=; b=EkcGeGTclIHwxqVjjDI/pxY1z2gIbq5RZfiCfEqsnml90OXcYc1fCzLwpoSWbkp8yf wvMGIbsXnN3DN+W2hqVjyWLIuX1rZznHdPw/3ebgxzaYsHyz/0zrf1CJvlPg3PvfMSEx qTTVSE0seWduVclbUQ32yATyvQQCTxmnpLYGKAFZ8nQ43lQyKYdkD41zZLDLLuzCcnab f9x1hhI+kg0BN0D/XXaOWXQbAoxio1nFvDQdFwyIXrQOp9+y3dtzUhOYp2+LCpEUt60m t1vYXQI0PSJGLHLm/OxApO0XPophzexhJ5aHNmkmbORdQVR3qBLTLQhWEaEUG5HrUNAx Bgqw== 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: APjAAAUNHRhjYV3RfVVCq2jy/idnVY72hhSK338ArReLG0xNOhg9udqz xXgtgDJHTQdghowt/uTnGvS92F4gLt64id+1qCZdl3u8NUUZljPH3ip6Xv4m7qrTuiGxFVbhJXv F63vT5nwoz5uJUoJXBZhW+MACeOgiZBOya+c8uK44P/EOj6jG84JwMo6XKy77pQ297A== X-Received: by 2002:ac8:28bc:: with SMTP id i57mr47906415qti.288.1560506532712; Fri, 14 Jun 2019 03:02:12 -0700 (PDT) X-Google-Smtp-Source: APXvYqwRa7R3Zk8+8XRJLz3iIzCqHFQyd79IOpesnaiOPL23bBJ1o07ppdddIrOSg510Q9VFpVA7 X-Received: by 2002:ac8:28bc:: with SMTP id i57mr47906250qti.288.1560506530788; Fri, 14 Jun 2019 03:02:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560506530; cv=none; d=google.com; s=arc-20160816; b=HVgnmTIF6X1jWdCGLQhSuruzhJsq6K/I+XvEfhRK3opwzZZXhEE3jtTEhVvRExzH5R +qvCQ/i7k9uc49TRVXF4tvlPbmNPWLht6Fr+u7KjE4wHFuGuw4/iFUMnUKBlbC5LcpPG UYvQEINoMfkxM/hqy/RpProuJm8uim+74U35Xmdpu8j3PO9ZY/t2Q4eXZZbwoQXWqMdg ybpFmG//JEZRXFo/8PtVRW5VVGUkj28JeFpl7DXgxXBu6EkKEaAw971y4qQaiBZbYVK2 lGrIan+xrF8pQcPoC0G0O8fMfz3ifBkUigIsLG89AV0iFkvhIbmOwNHXCodK1spjhpeU qVyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=GGbrHuVMDrkQm8Ggah1IohNNECSG1loyCUoeL7DCwug=; b=I1QAyTFoPzva8ywhblUClv8pAbq58TRFPn9j/cZy833sJ8zvSCpi0aBQO64HJ9MKTi tLkmK3jkUJf1nD1Di1BimrDnqIasbZ5tBeqNL49abVJl/oG3Rm5CnDYOdp8EXDV6vuHM eczEeBk3Exzuc4jnT7It5xPOP9uZ4iijHHogatqH3zs0eBUNEBkMF8VcdyFBUSyW/sfL FK/xc2pa1blMROKUQ0sJEv2Qed7Vuc0iys2njNOzRfoqxGSZOl7Um1HFRpTwkNlQW7bk kqvFp7UX9UFmqohqXgaC2SPhs6VwrrwCm5s3hu6pfZPCHxW+I2wPPvEDagTI0pFyydaC gYvQ== 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 n14si1481869qke.102.2019.06.14.03.02.10 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 14 Jun 2019 03:02:10 -0700 (PDT) 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-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 057EB3087930; Fri, 14 Jun 2019 10:02:10 +0000 (UTC) Received: from t460s.redhat.com (ovpn-116-252.ams2.redhat.com [10.36.116.252]) by smtp.corp.redhat.com (Postfix) with ESMTP id 58EA85D9C3; Fri, 14 Jun 2019 10:02:04 +0000 (UTC) From: David Hildenbrand To: linux-kernel@vger.kernel.org Cc: Dan Williams , Andrew Morton , linuxppc-dev@lists.ozlabs.org, linux-acpi@vger.kernel.org, linux-mm@kvack.org, David Hildenbrand , Greg Kroah-Hartman , "Rafael J. Wysocki" , Stephen Rothwell , Pavel Tatashin , "mike.travis@hpe.com" Subject: [PATCH v1 6/6] drivers/base/memory.c: Get rid of find_memory_block_hinted() Date: Fri, 14 Jun 2019 12:01:14 +0200 Message-Id: <20190614100114.311-7-david@redhat.com> In-Reply-To: <20190614100114.311-1-david@redhat.com> References: <20190614100114.311-1-david@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Fri, 14 Jun 2019 10:02:10 +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 No longer needed, let's remove it. Cc: Greg Kroah-Hartman Cc: "Rafael J. Wysocki" Cc: Andrew Morton Cc: Stephen Rothwell Cc: Pavel Tatashin Cc: "mike.travis@hpe.com" Signed-off-by: David Hildenbrand --- drivers/base/memory.c | 12 +++--------- include/linux/memory.h | 2 -- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/drivers/base/memory.c b/drivers/base/memory.c index 4f2e2f3b3d78..42e5a7493fe8 100644 --- a/drivers/base/memory.c +++ b/drivers/base/memory.c @@ -606,14 +606,6 @@ static struct memory_block *find_memory_block_by_id(unsigned long block_id, return to_memory_block(dev); } -struct memory_block *find_memory_block_hinted(struct mem_section *section, - struct memory_block *hint) -{ - unsigned long block_id = base_memory_block_id(__section_nr(section)); - - return find_memory_block_by_id(block_id, hint); -} - /* * For now, we have a linear search to go find the appropriate * memory_block corresponding to a particular phys_index. If @@ -624,7 +616,9 @@ struct memory_block *find_memory_block_hinted(struct mem_section *section, */ struct memory_block *find_memory_block(struct mem_section *section) { - return find_memory_block_hinted(section, NULL); + unsigned long block_id = base_memory_block_id(__section_nr(section)); + + return find_memory_block_by_id(block_id, hint); } static struct attribute *memory_memblk_attrs[] = { diff --git a/include/linux/memory.h b/include/linux/memory.h index b3b388775a30..02e633f3ede0 100644 --- a/include/linux/memory.h +++ b/include/linux/memory.h @@ -116,8 +116,6 @@ void remove_memory_block_devices(unsigned long start, unsigned long size); extern int memory_dev_init(void); extern int memory_notify(unsigned long val, void *v); extern int memory_isolate_notify(unsigned long val, void *v); -extern struct memory_block *find_memory_block_hinted(struct mem_section *, - struct memory_block *); extern struct memory_block *find_memory_block(struct mem_section *); typedef int (*walk_memory_blocks_func_t)(struct memory_block *, void *); extern int walk_memory_blocks(unsigned long start, unsigned long size,