linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild@01.org, Stefan Strogin <stefan.strogin@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Linux Memory Management List <linux-mm@kvack.org>,
	Dan Carpenter <dan.carpenter@oracle.com>
Subject: [next:master 9613/10050] mm/cma_debug.c:45 cma_used_get() warn: should 'used << cma->order_per_bit' be a 64 bit type?
Date: Wed, 8 Apr 2015 17:04:46 +0300	[thread overview]
Message-ID: <20150408140446.GR16501@mwanda> (raw)

tree:   git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   a897436e0e233e84b664bb7f33c4e0d4d3e3bdad
commit: 8b0c0ea86849b55091281d146d62bbd9cda87556 [9613/10050] mm-cma-add-functions-to-get-region-pages-counters-fix-2

mm/cma_debug.c:45 cma_used_get() warn: should 'used << cma->order_per_bit' be a 64 bit type?
mm/cma_debug.c:67 cma_maxchunk_get() warn: should 'maxchunk << cma->order_per_bit' be a 64 bit type?

git remote add next git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
git remote update next
git checkout 8b0c0ea86849b55091281d146d62bbd9cda87556
vim +45 mm/cma_debug.c

8b0c0ea8 Stefan Strogin 2015-04-08  39  	unsigned long used;
c8e6dfcb Dmitry Safonov 2015-04-08  40  
8b0c0ea8 Stefan Strogin 2015-04-08  41  	mutex_lock(&cma->lock);
8b0c0ea8 Stefan Strogin 2015-04-08  42  	/* pages counter is smaller than sizeof(int) */
8b0c0ea8 Stefan Strogin 2015-04-08  43  	used = bitmap_weight(cma->bitmap, (int)cma->count);
8b0c0ea8 Stefan Strogin 2015-04-08  44  	mutex_unlock(&cma->lock);
8b0c0ea8 Stefan Strogin 2015-04-08 @45  	*val = used << cma->order_per_bit;
c8e6dfcb Dmitry Safonov 2015-04-08  46  
c8e6dfcb Dmitry Safonov 2015-04-08  47  	return 0;
c8e6dfcb Dmitry Safonov 2015-04-08  48  }
c8e6dfcb Dmitry Safonov 2015-04-08  49  
c8e6dfcb Dmitry Safonov 2015-04-08  50  DEFINE_SIMPLE_ATTRIBUTE(cma_used_fops, cma_used_get, NULL, "%llu\n");
c8e6dfcb Dmitry Safonov 2015-04-08  51  
c8e6dfcb Dmitry Safonov 2015-04-08  52  static int cma_maxchunk_get(void *data, u64 *val)
c8e6dfcb Dmitry Safonov 2015-04-08  53  {
c8e6dfcb Dmitry Safonov 2015-04-08  54  	struct cma *cma = data;
8b0c0ea8 Stefan Strogin 2015-04-08  55  	unsigned long maxchunk = 0;
8b0c0ea8 Stefan Strogin 2015-04-08  56  	unsigned long start, end = 0;
c8e6dfcb Dmitry Safonov 2015-04-08  57  
8b0c0ea8 Stefan Strogin 2015-04-08  58  	mutex_lock(&cma->lock);
8b0c0ea8 Stefan Strogin 2015-04-08  59  	for (;;) {
8b0c0ea8 Stefan Strogin 2015-04-08  60  		start = find_next_zero_bit(cma->bitmap, cma->count, end);
8b0c0ea8 Stefan Strogin 2015-04-08  61  		if (start >= cma->count)
8b0c0ea8 Stefan Strogin 2015-04-08  62  			break;
8b0c0ea8 Stefan Strogin 2015-04-08  63  		end = find_next_bit(cma->bitmap, cma->count, start);
8b0c0ea8 Stefan Strogin 2015-04-08  64  		maxchunk = max(end - start, maxchunk);
8b0c0ea8 Stefan Strogin 2015-04-08  65  	}
8b0c0ea8 Stefan Strogin 2015-04-08  66  	mutex_unlock(&cma->lock);
8b0c0ea8 Stefan Strogin 2015-04-08 @67  	*val = maxchunk << cma->order_per_bit;
c8e6dfcb Dmitry Safonov 2015-04-08  68  
c8e6dfcb Dmitry Safonov 2015-04-08  69  	return 0;
c8e6dfcb Dmitry Safonov 2015-04-08  70  }

---
0-DAY kernel test infrastructure                Open Source Technology Center
http://lists.01.org/mailman/listinfo/kbuild                 Intel Corporation

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

             reply	other threads:[~2015-04-08 14:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-08 14:04 Dan Carpenter [this message]
2015-04-08 19:45 ` [PATCH] mm-cma-add-functions-to-get-region-pages-counters-fix-3 Dmitry Safonov
2015-04-08 20:55   ` Michal Nazarewicz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150408140446.GR16501@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=kbuild@01.org \
    --cc=linux-mm@kvack.org \
    --cc=stefan.strogin@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).