All of lore.kernel.org
 help / color / mirror / Atom feed
* [Patch] mm/policy: use int instead of unsigned for nid
@ 2012-07-04  3:01 ` Cong Wang
  0 siblings, 0 replies; 5+ messages in thread
From: Cong Wang @ 2012-07-04  3:01 UTC (permalink / raw)
  To: linux-kernel
  Cc: Andrew Morton, WANG Cong, KOSAKI Motohiro, Mel Gorman,
	David Rientjes, Rik van Riel, linux-mm

From: WANG Cong <xiyou.wangcong@gmail.com>

'nid' should be 'int', not 'unsigned'.

Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: Mel Gorman <mgorman@suse.de>
Cc: David Rientjes <rientjes@google.com>
Cc: Rik van Riel <riel@redhat.com>
Signed-off-by: WANG Cong <xiyou.wangcong@gmail.com>

---
diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index 1d771e4..3cabe81 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -1580,9 +1580,9 @@ static struct zonelist *policy_zonelist(gfp_t gfp, struct mempolicy *policy,
 }
 
 /* Do dynamic interleaving for a process */
-static unsigned interleave_nodes(struct mempolicy *policy)
+static int interleave_nodes(struct mempolicy *policy)
 {
-	unsigned nid, next;
+	int nid, next;
 	struct task_struct *me = current;
 
 	nid = me->il_next;
@@ -1638,7 +1638,7 @@ unsigned slab_node(struct mempolicy *policy)
 }
 
 /* Do static interleaving for a VMA with known offset. */
-static unsigned offset_il_node(struct mempolicy *pol,
+static int offset_il_node(struct mempolicy *pol,
 		struct vm_area_struct *vma, unsigned long off)
 {
 	unsigned nnodes = nodes_weight(pol->v.nodes);
@@ -1658,7 +1658,7 @@ static unsigned offset_il_node(struct mempolicy *pol,
 }
 
 /* Determine a node number for interleave */
-static inline unsigned interleave_nid(struct mempolicy *pol,
+static inline int interleave_nid(struct mempolicy *pol,
 		 struct vm_area_struct *vma, unsigned long addr, int shift)
 {
 	if (vma) {
@@ -1827,7 +1827,7 @@ out:
 /* Allocate a page in interleaved policy.
    Own path because it needs to do special accounting. */
 static struct page *alloc_page_interleave(gfp_t gfp, unsigned order,
-					unsigned nid)
+					int nid)
 {
 	struct zonelist *zl;
 	struct page *page;
@@ -1876,7 +1876,7 @@ retry_cpuset:
 	cpuset_mems_cookie = get_mems_allowed();
 
 	if (unlikely(pol->mode == MPOL_INTERLEAVE)) {
-		unsigned nid;
+		int nid;
 
 		nid = interleave_nid(pol, vma, addr, PAGE_SHIFT + order);
 		mpol_cond_put(pol);

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [Patch] mm/policy: use int instead of unsigned for nid
@ 2012-07-04  3:01 ` Cong Wang
  0 siblings, 0 replies; 5+ messages in thread
From: Cong Wang @ 2012-07-04  3:01 UTC (permalink / raw)
  To: linux-kernel
  Cc: Andrew Morton, WANG Cong, KOSAKI Motohiro, Mel Gorman,
	David Rientjes, Rik van Riel, linux-mm

From: WANG Cong <xiyou.wangcong@gmail.com>

'nid' should be 'int', not 'unsigned'.

Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: Mel Gorman <mgorman@suse.de>
Cc: David Rientjes <rientjes@google.com>
Cc: Rik van Riel <riel@redhat.com>
Signed-off-by: WANG Cong <xiyou.wangcong@gmail.com>

---
diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index 1d771e4..3cabe81 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -1580,9 +1580,9 @@ static struct zonelist *policy_zonelist(gfp_t gfp, struct mempolicy *policy,
 }
 
 /* Do dynamic interleaving for a process */
-static unsigned interleave_nodes(struct mempolicy *policy)
+static int interleave_nodes(struct mempolicy *policy)
 {
-	unsigned nid, next;
+	int nid, next;
 	struct task_struct *me = current;
 
 	nid = me->il_next;
@@ -1638,7 +1638,7 @@ unsigned slab_node(struct mempolicy *policy)
 }
 
 /* Do static interleaving for a VMA with known offset. */
-static unsigned offset_il_node(struct mempolicy *pol,
+static int offset_il_node(struct mempolicy *pol,
 		struct vm_area_struct *vma, unsigned long off)
 {
 	unsigned nnodes = nodes_weight(pol->v.nodes);
@@ -1658,7 +1658,7 @@ static unsigned offset_il_node(struct mempolicy *pol,
 }
 
 /* Determine a node number for interleave */
-static inline unsigned interleave_nid(struct mempolicy *pol,
+static inline int interleave_nid(struct mempolicy *pol,
 		 struct vm_area_struct *vma, unsigned long addr, int shift)
 {
 	if (vma) {
@@ -1827,7 +1827,7 @@ out:
 /* Allocate a page in interleaved policy.
    Own path because it needs to do special accounting. */
 static struct page *alloc_page_interleave(gfp_t gfp, unsigned order,
-					unsigned nid)
+					int nid)
 {
 	struct zonelist *zl;
 	struct page *page;
@@ -1876,7 +1876,7 @@ retry_cpuset:
 	cpuset_mems_cookie = get_mems_allowed();
 
 	if (unlikely(pol->mode == MPOL_INTERLEAVE)) {
-		unsigned nid;
+		int nid;
 
 		nid = interleave_nid(pol, vma, addr, PAGE_SHIFT + order);
 		mpol_cond_put(pol);

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

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [Patch] mm/policy: use int instead of unsigned for nid
  2012-07-04  3:01 ` Cong Wang
@ 2012-07-04  6:43   ` David Rientjes
  -1 siblings, 0 replies; 5+ messages in thread
From: David Rientjes @ 2012-07-04  6:43 UTC (permalink / raw)
  To: Cong Wang
  Cc: linux-kernel, Andrew Morton, WANG Cong, KOSAKI Motohiro,
	Mel Gorman, Rik van Riel, linux-mm

On Wed, 4 Jul 2012, Cong Wang wrote:

> From: WANG Cong <xiyou.wangcong@gmail.com>
> 
> 'nid' should be 'int', not 'unsigned'.
> 

unsigned is already of type int, so you're saying these occurrences should 
become signed, but that's not true since they never return NUMA_NO_NODE.  
They are all safe returning unsigned.

And alloc_page_interleave() doesn't exist anymore since the sched/numa 
bits were merged into sched/core, so nobody could apply this patch anyway.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Patch] mm/policy: use int instead of unsigned for nid
@ 2012-07-04  6:43   ` David Rientjes
  0 siblings, 0 replies; 5+ messages in thread
From: David Rientjes @ 2012-07-04  6:43 UTC (permalink / raw)
  To: Cong Wang
  Cc: linux-kernel, Andrew Morton, WANG Cong, KOSAKI Motohiro,
	Mel Gorman, Rik van Riel, linux-mm

On Wed, 4 Jul 2012, Cong Wang wrote:

> From: WANG Cong <xiyou.wangcong@gmail.com>
> 
> 'nid' should be 'int', not 'unsigned'.
> 

unsigned is already of type int, so you're saying these occurrences should 
become signed, but that's not true since they never return NUMA_NO_NODE.  
They are all safe returning unsigned.

And alloc_page_interleave() doesn't exist anymore since the sched/numa 
bits were merged into sched/core, so nobody could apply this patch anyway.

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Patch] mm/policy: use int instead of unsigned for nid
  2012-07-04  6:43   ` David Rientjes
  (?)
@ 2012-07-05 13:37   ` Cong Wang
  -1 siblings, 0 replies; 5+ messages in thread
From: Cong Wang @ 2012-07-05 13:37 UTC (permalink / raw)
  To: linux-kernel; +Cc: linux-mm

On Wed, 04 Jul 2012 at 06:43 GMT, David Rientjes <rientjes@google.com> wrote:
> On Wed, 4 Jul 2012, Cong Wang wrote:
>
>> From: WANG Cong <xiyou.wangcong@gmail.com>
>> 
>> 'nid' should be 'int', not 'unsigned'.
>> 
>
> unsigned is already of type int, so you're saying these occurrences should 
> become signed, but that's not true since they never return NUMA_NO_NODE.  
> They are all safe returning unsigned.
>

Yeah, I knew, just thought using 'int' is consistent, this is a
trivial patch, not a bugfix.

> And alloc_page_interleave() doesn't exist anymore since the sched/numa 
> bits were merged into sched/core, so nobody could apply this patch anyway.

Ah, I made this patch against linus tree...


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-07-05 13:37 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-04  3:01 [Patch] mm/policy: use int instead of unsigned for nid Cong Wang
2012-07-04  3:01 ` Cong Wang
2012-07-04  6:43 ` David Rientjes
2012-07-04  6:43   ` David Rientjes
2012-07-05 13:37   ` Cong Wang

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.