All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexandru Moise <00moses.alexander00@gmail.com>
To: akpm@linux-foundation.org
Cc: mgorman@suse.de, vbabka@suse.cz, mhocko@suse.com,
	rientjes@google.com, js1304@gmail.com, hannes@cmpxchg.org,
	alexander.h.duyck@redhat.com, sasha.levin@oracle.com,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: [PATCH 1/2] mm: change free_cma and free_pages declarations to unsigned
Date: Sun, 27 Sep 2015 21:04:16 +0000	[thread overview]
Message-ID: <20150927210416.GA20144@gmail.com> (raw)

Their stored values come from zone_page_state() which returns
an unsigned long. To improve code correctness we should avoid
mixing signed and unsigned integers.

Signed-off-by: Alexandru Moise <00moses.alexander00@gmail.com>
---
 mm/page_alloc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 48aaf7b..f55e3a2 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -2242,7 +2242,7 @@ static bool __zone_watermark_ok(struct zone *z, unsigned int order,
 	/* free_pages may go negative - that's OK */
 	long min = mark;
 	int o;
-	long free_cma = 0;
+	unsigned long free_cma = 0;
 
 	free_pages -= (1 << order) - 1;
 	if (alloc_flags & ALLOC_HIGH)
@@ -2280,7 +2280,7 @@ bool zone_watermark_ok(struct zone *z, unsigned int order, unsigned long mark,
 bool zone_watermark_ok_safe(struct zone *z, unsigned int order,
 			unsigned long mark, int classzone_idx, int alloc_flags)
 {
-	long free_pages = zone_page_state(z, NR_FREE_PAGES);
+	unsigned long free_pages = zone_page_state(z, NR_FREE_PAGES);
 
 	if (z->percpu_drift_mark && free_pages < z->percpu_drift_mark)
 		free_pages = zone_page_state_snapshot(z, NR_FREE_PAGES);
-- 
2.5.3

--
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>

WARNING: multiple messages have this Message-ID (diff)
From: Alexandru Moise <00moses.alexander00@gmail.com>
To: akpm@linux-foundation.org
Cc: mgorman@suse.de, vbabka@suse.cz, mhocko@suse.com,
	rientjes@google.com, js1304@gmail.com, hannes@cmpxchg.org,
	alexander.h.duyck@redhat.com, sasha.levin@oracle.com,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: [PATCH 1/2] mm: change free_cma and free_pages declarations to unsigned
Date: Sun, 27 Sep 2015 21:04:16 +0000	[thread overview]
Message-ID: <20150927210416.GA20144@gmail.com> (raw)

Their stored values come from zone_page_state() which returns
an unsigned long. To improve code correctness we should avoid
mixing signed and unsigned integers.

Signed-off-by: Alexandru Moise <00moses.alexander00@gmail.com>
---
 mm/page_alloc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 48aaf7b..f55e3a2 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -2242,7 +2242,7 @@ static bool __zone_watermark_ok(struct zone *z, unsigned int order,
 	/* free_pages may go negative - that's OK */
 	long min = mark;
 	int o;
-	long free_cma = 0;
+	unsigned long free_cma = 0;
 
 	free_pages -= (1 << order) - 1;
 	if (alloc_flags & ALLOC_HIGH)
@@ -2280,7 +2280,7 @@ bool zone_watermark_ok(struct zone *z, unsigned int order, unsigned long mark,
 bool zone_watermark_ok_safe(struct zone *z, unsigned int order,
 			unsigned long mark, int classzone_idx, int alloc_flags)
 {
-	long free_pages = zone_page_state(z, NR_FREE_PAGES);
+	unsigned long free_pages = zone_page_state(z, NR_FREE_PAGES);
 
 	if (z->percpu_drift_mark && free_pages < z->percpu_drift_mark)
 		free_pages = zone_page_state_snapshot(z, NR_FREE_PAGES);
-- 
2.5.3


             reply	other threads:[~2015-09-27 18:04 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-27 21:04 Alexandru Moise [this message]
2015-09-27 21:04 ` [PATCH 1/2] mm: change free_cma and free_pages declarations to unsigned Alexandru Moise
2015-09-29 10:13 ` Mel Gorman
2015-09-29 10:13   ` Mel Gorman
2015-09-29 10:26   ` Alexandru Moise
2015-09-29 10:26     ` Alexandru Moise

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=20150927210416.GA20144@gmail.com \
    --to=00moses.alexander00@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=alexander.h.duyck@redhat.com \
    --cc=hannes@cmpxchg.org \
    --cc=js1304@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@suse.de \
    --cc=mhocko@suse.com \
    --cc=rientjes@google.com \
    --cc=sasha.levin@oracle.com \
    --cc=vbabka@suse.cz \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.