From patchwork Mon Mar 29 18:25:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Minchan Kim X-Patchwork-Id: 12170727 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 70C4FC433C1 for ; Mon, 29 Mar 2021 18:26:38 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id F15CB6192F for ; Mon, 29 Mar 2021 18:26:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F15CB6192F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 3CACE6B007D; Mon, 29 Mar 2021 14:26:37 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 37A876B007E; Mon, 29 Mar 2021 14:26:37 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 21B006B0080; Mon, 29 Mar 2021 14:26:37 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0244.hostedemail.com [216.40.44.244]) by kanga.kvack.org (Postfix) with ESMTP id 01F7D6B007D for ; Mon, 29 Mar 2021 14:26:36 -0400 (EDT) Received: from smtpin38.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id B031E181AEF3E for ; Mon, 29 Mar 2021 18:26:36 +0000 (UTC) X-FDA: 77973742392.38.9B68ED1 Received: from mail-pf1-f172.google.com (mail-pf1-f172.google.com [209.85.210.172]) by imf06.hostedemail.com (Postfix) with ESMTP id 82C2AC0042D5 for ; Mon, 29 Mar 2021 18:26:28 +0000 (UTC) Received: by mail-pf1-f172.google.com with SMTP id v10so5063956pfn.5 for ; Mon, 29 Mar 2021 11:26:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=u+59y0AgHiCfa77pcnvLNXwvfOfWr12NxzeqiJWwICM=; b=tvc0JlPZB8KS4gWQqc3cM0KfLUX2R4UXyDMt7DKDT1Mm1ogaDmzTmMvdYRkvoJsXcx s2qQjvRu1JexihwYHvQ4vrexUlbJGnrq9XlA7HIwIojtQUTgKzL0N/lvsA0emx4asMDV IEGD5KJZOvtIrdQRAC+TW7dyncY3IPDd8sQsR5cLkqLTp7n9hGiiK9dO9z6knnwtihcD MATMTm0EZ4ZAICybtQC5wK8ctU8k86o07hkx35QjZES5X6n+CDyKuEpsmidGHfDciwsb fYhfAVKdNZox00icj/0jAsx5J287lNMYdFHoidLDDG4Th32d0Ag3DFqMWSO+bRV1vnNC QbGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :mime-version:content-transfer-encoding; bh=u+59y0AgHiCfa77pcnvLNXwvfOfWr12NxzeqiJWwICM=; b=tW5nlldNyq50TKHYiUTmGjMjLfwhkvXhSmH1gGNkKglA1oO8XXzNEIY56O8X3YkWQT Ludb41kFkslT0Mg0SGkQIhb/WIhicK1VM/fNzaOfKTcFMILj+qrwf7/p4ooPQ9FxhHlN 4JciLpDeMHRzRoz5uvmGyk0yrLDRG7tpwgW/12cwOmtjgVooHKx0gIXGg5RWoA0VmC2x TIh5Bc0THFISwCSxDvpEscz2lFbzLCpXfK0CbggOQTFHerhuy39bfW8AFlzXPAiMoWak MDtYDh2/SEAFlpZSaku2CM6n5rsh2sRSJXjEMm7McxeThmXeT6EqYtYXB34aqe2XHtU8 yrOw== X-Gm-Message-State: AOAM532Bj+Sk89oSB+9JjtxrpLHLi4gLwhUl5eo0LKG7BMcENnY61ftT ITsFjdIIpTKeEVD2cKEHx7c= X-Google-Smtp-Source: ABdhPJwp8ypTTZarskX1sJRiiD2a2nR+WHK4mxCU+pXx+fgTZeG9QwpK6DEFiWtzZ7tCN7QppynIeg== X-Received: by 2002:a63:4944:: with SMTP id y4mr3304413pgk.9.1617042386769; Mon, 29 Mar 2021 11:26:26 -0700 (PDT) Received: from bbox-1.mtv.corp.google.com ([2620:15c:211:201:e9af:f14a:516c:eaef]) by smtp.gmail.com with ESMTPSA id w191sm20034744pfd.25.2021.03.29.11.26.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Mar 2021 11:26:25 -0700 (PDT) From: Minchan Kim To: Andrew Morton Cc: linux-mm , LKML , Minchan Kim , Matthew Wilcox Subject: [PATCH] mm: change size_t to unsigned int for cma_alloc Date: Mon, 29 Mar 2021 11:25:53 -0700 Message-Id: <20210329182553.3129234-1-minchan@kernel.org> X-Mailer: git-send-email 2.31.0.291.g576ba9dcdaf-goog MIME-Version: 1.0 X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 82C2AC0042D5 X-Stat-Signature: 9seiuk4r8pdb38sxjorokhtgdyje11cs Received-SPF: none (gmail.com>: No applicable sender policy available) receiver=imf06; identity=mailfrom; envelope-from=""; helo=mail-pf1-f172.google.com; client-ip=209.85.210.172 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1617042388-210830 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: size_t in cma_alloc is confusing since it makes people think it's byte count, not pages. Fix it. Link: https://lore.kernel.org/linux-mm/20210324043434.GP1719932@casper.infradead.org/ Cc: Matthew Wilcox Signed-off-by: Minchan Kim --- include/linux/cma.h | 2 +- mm/cma.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/linux/cma.h b/include/linux/cma.h index 217999c8a762..a873edc20ca2 100644 --- a/include/linux/cma.h +++ b/include/linux/cma.h @@ -44,7 +44,7 @@ extern int cma_init_reserved_mem(phys_addr_t base, phys_addr_t size, unsigned int order_per_bit, const char *name, struct cma **res_cma); -extern struct page *cma_alloc(struct cma *cma, size_t count, unsigned int align, +extern struct page *cma_alloc(struct cma *cma, unsigned int count, unsigned int align, bool no_warn); extern bool cma_release(struct cma *cma, const struct page *pages, unsigned int count); diff --git a/mm/cma.c b/mm/cma.c index 08c45157911a..24dc01e26d45 100644 --- a/mm/cma.c +++ b/mm/cma.c @@ -423,21 +423,21 @@ static inline void cma_debug_show_areas(struct cma *cma) { } * This function allocates part of contiguous memory on specific * contiguous memory area. */ -struct page *cma_alloc(struct cma *cma, size_t count, unsigned int align, +struct page *cma_alloc(struct cma *cma, unsigned int count, unsigned int align, bool no_warn) { unsigned long mask, offset; unsigned long pfn = -1; unsigned long start = 0; unsigned long bitmap_maxno, bitmap_no, bitmap_count; - size_t i; + unsigned int i; struct page *page = NULL; int ret = -ENOMEM; if (!cma || !cma->count || !cma->bitmap) goto out; - pr_debug("%s(cma %p, count %zu, align %d)\n", __func__, (void *)cma, + pr_debug("%s(cma %p, count %u, align %d)\n", __func__, (void *)cma, count, align); if (!count) @@ -500,7 +500,7 @@ struct page *cma_alloc(struct cma *cma, size_t count, unsigned int align, } if (ret && !no_warn) { - pr_err_ratelimited("%s: %s: alloc failed, req-size: %zu pages, ret: %d\n", + pr_err_ratelimited("%s: %s: alloc failed, req-size: %u pages, ret: %d\n", __func__, cma->name, count, ret); cma_debug_show_areas(cma); }