From patchwork Thu May 3 23:29:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Kravetz X-Patchwork-Id: 10379451 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C393260327 for ; Thu, 3 May 2018 23:29:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BA0BD292A4 for ; Thu, 3 May 2018 23:29:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AE0CF292A7; Thu, 3 May 2018 23:29:55 +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=-3.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, UNPARSEABLE_RELAY 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 2DF83292A4 for ; Thu, 3 May 2018 23:29:54 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 785756B000C; Thu, 3 May 2018 19:29:53 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 6E5136B0010; Thu, 3 May 2018 19:29:53 -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 5D34B6B0011; Thu, 3 May 2018 19:29:53 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-ua0-f200.google.com (mail-ua0-f200.google.com [209.85.217.200]) by kanga.kvack.org (Postfix) with ESMTP id 323A36B000C for ; Thu, 3 May 2018 19:29:53 -0400 (EDT) Received: by mail-ua0-f200.google.com with SMTP id z4so17105775uaa.15 for ; Thu, 03 May 2018 16:29:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:from:to:cc:subject:date :message-id:in-reply-to:references; bh=RgN0wHoC6ecTcTrHOKpua6WjBBLKSpt1DBJSLSRlC+I=; b=q3lEHIVwfPlxrkf4ekx9O8bJc7xI+gCS4+iUouyYogYt2RTc/+vMKksm8UG7dWNndA DUqa8Gs6yyIR2nXiLrvh2NMycEjChJr4WwiFSXxQsFROyhdDgYv4pdgGaBxAhLvzP4q3 LnMLzBx1ujfbWKgOkMkkyBZIp6rvBDeXh/Kl7SKDJ1WaldBDKj0TzsBBR+5eWrOZd7l/ UPZ6g/spKHMAEMYHuvfMBgzFcH040A3QN4V7YJLSGTom5scF9dPnDkxVOnjnaEixK7Go 9maqM3YBIqNSsOxBp+QSnPnInKhWXogt8o+QCFgatWQLBsb8CLomjLsh7KPlK8lsOi29 rnGw== X-Gm-Message-State: ALQs6tD7+BC0JqXeXCMF/v5lbHz1BDuDBH7A0wFcSOSxU+B3Ut+AZsvR Nd0ylNS70voIdd+G77qtQAHKvLPAMiRQ+PUH/dmlc0cnNe/0KW/a7FN06nVC/INy00nAlahf/Uh eCiyuHipCneVtAh8hJVmNV3MOgMjSWxETcU2FU/CQhhmulqp11AsH0nwx8rL+xxrqKg== X-Received: by 10.176.25.207 with SMTP id r15mr10759078uai.149.1525390192833; Thu, 03 May 2018 16:29:52 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqMy2lSv6sxmt1JVZaX9pLM+GVQXB5fagatBShokhhQM2kSTiCHkTHncG8Zy7gD51wnXpEt X-Received: by 10.176.25.207 with SMTP id r15mr10759059uai.149.1525390191933; Thu, 03 May 2018 16:29:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525390191; cv=none; d=google.com; s=arc-20160816; b=r21tCJeHc35NMSFz0GVDr9nqsePFEOrvEfOLiPqgmukAeW/PrxTUqobCP2l7DpgEZS RMUxtO2AJlrAoF37sl+QtQkXnLPpLoGnEu3t3xRRO5wTkj3MHGVSU5lnySLcRGeBYWGB UCcBAc2l0oEvielFOjiLtP9oa6xezvTnTKms9gPdEpOBtRCFZx/M6Q8U5+bPeUr0QR1+ d/yOkoAFxWc4dWDpTqI5MSTpM8h21DuAsZhq6OxP1nPXoWrPTZNAJaDVrGz4Aps0RoJ8 XqnVVU0D1SX3JT28xv55uXkSR3d+hj7rgMXGeQnqeaiPWnaRvUkmdpFJ57xOFL/k6/h5 v1pg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=RgN0wHoC6ecTcTrHOKpua6WjBBLKSpt1DBJSLSRlC+I=; b=EMlK1esumt+jQnp68/kcR3PVSH17vcBBB7QwIoYc+Njp+nh4ltwFjs1xAUiLfvpC1X qDUvFEakqDhm6UkGZfP7b2NUfauTD98/azB4z3d4k7/TC5p9k7cPEsXiMEuq0JbS3jm1 VnfP9NBSe51I+pwshStP2moUk1hyX/HW2PGplvmR7dRpDLHC0tldA8++BwoXUJLPHF/l i4we3LA7HNBb+jhEtSAL9aymAuMOEEW0W4DY8R85eRpwt0Ia2QoGb4S/tZJRz6q68n70 qKGK+Wst6my8JPtTJ3hTw7IFStjTxrJDwLSbtHpUQfGTxaDzh8V85F25Avr6G1o8beSw 4XYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=FUF1YQtn; spf=pass (google.com: domain of mike.kravetz@oracle.com designates 141.146.126.79 as permitted sender) smtp.mailfrom=mike.kravetz@oracle.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: from aserp2130.oracle.com (aserp2130.oracle.com. [141.146.126.79]) by mx.google.com with ESMTPS id g28si6928792uaj.220.2018.05.03.16.29.51 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 03 May 2018 16:29:51 -0700 (PDT) Received-SPF: pass (google.com: domain of mike.kravetz@oracle.com designates 141.146.126.79 as permitted sender) client-ip=141.146.126.79; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=FUF1YQtn; spf=pass (google.com: domain of mike.kravetz@oracle.com designates 141.146.126.79 as permitted sender) smtp.mailfrom=mike.kravetz@oracle.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w43NM6wb176637; Thu, 3 May 2018 23:29:47 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=corp-2017-10-26; bh=RgN0wHoC6ecTcTrHOKpua6WjBBLKSpt1DBJSLSRlC+I=; b=FUF1YQtnG24yXVVUmrt07fWzsPOpS643oPLIp4B6iDNlkveajDTuEK9rfylbmroMr9Zk o44TA/7fHSF14GpRWzTLMtW7ayiamTbqZZlIAnyEcI7pVxkHssTRZkF8SL124IfXYVAC Xb/sk36cUfCYbhE/+88F3dUx2A3aAGYyYbeKWZfBABOydqknP+dcDh1fTDX5L+YhTW0j qoQZmy6fXoLP/kMd+YER4bTytQdMGvuyMwdfmTHN4jVlXKa+xVkVwraSHCcFzkb3xicy 2Sj65YCMahCg4G8eqUi68O7szbL1oMvxxU4KvTkzLLh0LXQ6eOqsbXHSwltLmlTwshBU aA== Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by aserp2130.oracle.com with ESMTP id 2hmeg642uj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 03 May 2018 23:29:47 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w43NTkqP032154 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 3 May 2018 23:29:46 GMT Received: from abhmp0019.oracle.com (abhmp0019.oracle.com [141.146.116.25]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w43NTjqs030991; Thu, 3 May 2018 23:29:45 GMT Received: from monkey.oracle.com (/50.38.38.67) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 03 May 2018 16:29:45 -0700 From: Mike Kravetz To: linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-api@vger.kernel.org Cc: Reinette Chatre , Michal Hocko , Christopher Lameter , Guy Shattah , Anshuman Khandual , Michal Nazarewicz , Vlastimil Babka , David Nellans , Laura Abbott , Pavel Machek , Dave Hansen , Andrew Morton , Mike Kravetz Subject: [PATCH v2 1/4] mm: change type of free_contig_range(nr_pages) to unsigned long Date: Thu, 3 May 2018 16:29:32 -0700 Message-Id: <20180503232935.22539-2-mike.kravetz@oracle.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20180503232935.22539-1-mike.kravetz@oracle.com> References: <20180503232935.22539-1-mike.kravetz@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8882 signatures=668698 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=2 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=820 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1805030204 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 free_contig_range() is currently defined as: void free_contig_range(unsigned long pfn, unsigned nr_pages); change to, void free_contig_range(unsigned long pfn, unsigned long nr_pages); Some callers are passing a truncated unsigned long today. It is highly unlikely that these values will overflow an unsigned int. However, this should be changed to an unsigned long to be consistent with other page counts. Signed-off-by: Mike Kravetz --- include/linux/gfp.h | 2 +- mm/cma.c | 2 +- mm/hugetlb.c | 2 +- mm/page_alloc.c | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/linux/gfp.h b/include/linux/gfp.h index 1a4582b44d32..86a0d06463ab 100644 --- a/include/linux/gfp.h +++ b/include/linux/gfp.h @@ -572,7 +572,7 @@ static inline bool pm_suspended_storage(void) /* The below functions must be run on a range from a single zone. */ extern int alloc_contig_range(unsigned long start, unsigned long end, unsigned migratetype, gfp_t gfp_mask); -extern void free_contig_range(unsigned long pfn, unsigned nr_pages); +extern void free_contig_range(unsigned long pfn, unsigned long nr_pages); #endif #ifdef CONFIG_CMA diff --git a/mm/cma.c b/mm/cma.c index aa40e6c7b042..f473fc2b7cbd 100644 --- a/mm/cma.c +++ b/mm/cma.c @@ -563,7 +563,7 @@ bool cma_release(struct cma *cma, const struct page *pages, unsigned int count) VM_BUG_ON(pfn + count > cma->base_pfn + cma->count); - free_contig_range(pfn, count); + free_contig_range(pfn, (unsigned long)count); cma_clear_bitmap(cma, pfn, count); trace_cma_release(pfn, pages, count); diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 218679138255..c81072ce7510 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -1055,7 +1055,7 @@ static void destroy_compound_gigantic_page(struct page *page, static void free_gigantic_page(struct page *page, unsigned int order) { - free_contig_range(page_to_pfn(page), 1 << order); + free_contig_range(page_to_pfn(page), 1UL << order); } static int __alloc_gigantic_page(unsigned long start_pfn, diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 905db9d7962f..0fd5e8e2456e 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -7937,9 +7937,9 @@ int alloc_contig_range(unsigned long start, unsigned long end, return ret; } -void free_contig_range(unsigned long pfn, unsigned nr_pages) +void free_contig_range(unsigned long pfn, unsigned long nr_pages) { - unsigned int count = 0; + unsigned long count = 0; for (; nr_pages--; pfn++) { struct page *page = pfn_to_page(pfn); @@ -7947,7 +7947,7 @@ void free_contig_range(unsigned long pfn, unsigned nr_pages) count += page_count(page) != 1; __free_page(page); } - WARN(count != 0, "%d pages are still in use!\n", count); + WARN(count != 0, "%ld pages are still in use!\n", count); } #endif