* [PATCH 1/7] mm: fix return type for functions nr_free_*_pages
2013-02-06 5:11 [PATCH 0/7] mm: fix types for some functions and variables in case of overflow Zhang Yanfei
@ 2013-02-06 5:15 ` Zhang Yanfei
2013-02-06 5:16 ` [PATCH 2/7] ia64: use %ld to print pages calculated in nr_free_buffer_pages Zhang Yanfei
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Zhang Yanfei @ 2013-02-06 5:15 UTC (permalink / raw)
To: Andrew Morton, mgorman, minchan, kamezawa.hiroyu
Cc: Linux MM, linux-kernel@vger.kernel.org
Currently, the amount of RAM that functions nr_free_*_pages return
is held in unsigned int. But in machines with big memory (exceeding
16TB), the amount may be incorrect because of overflow, so fix it.
Signed-off-by: Zhang Yanfei <zhangyanfei@cn.fujitsu.com>
---
include/linux/swap.h | 4 ++--
mm/page_alloc.c | 8 ++++----
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/include/linux/swap.h b/include/linux/swap.h
index 68df9c1..c238323 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -216,8 +216,8 @@ struct swap_list_t {
extern unsigned long totalram_pages;
extern unsigned long totalreserve_pages;
extern unsigned long dirty_balance_reserve;
-extern unsigned int nr_free_buffer_pages(void);
-extern unsigned int nr_free_pagecache_pages(void);
+extern unsigned long nr_free_buffer_pages(void);
+extern unsigned long nr_free_pagecache_pages(void);
/* Definition of global_page_state not available yet */
#define nr_free_pages() global_page_state(NR_FREE_PAGES)
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index df2022f..4acf733 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -2785,13 +2785,13 @@ void free_pages_exact(void *virt, size_t size)
}
EXPORT_SYMBOL(free_pages_exact);
-static unsigned int nr_free_zone_pages(int offset)
+static unsigned long nr_free_zone_pages(int offset)
{
struct zoneref *z;
struct zone *zone;
/* Just pick one node, since fallback list is circular */
- unsigned int sum = 0;
+ unsigned long sum = 0;
struct zonelist *zonelist = node_zonelist(numa_node_id(), GFP_KERNEL);
@@ -2808,7 +2808,7 @@ static unsigned int nr_free_zone_pages(int offset)
/*
* Amount of free RAM allocatable within ZONE_DMA and ZONE_NORMAL
*/
-unsigned int nr_free_buffer_pages(void)
+unsigned long nr_free_buffer_pages(void)
{
return nr_free_zone_pages(gfp_zone(GFP_USER));
}
@@ -2817,7 +2817,7 @@ EXPORT_SYMBOL_GPL(nr_free_buffer_pages);
/*
* Amount of free RAM allocatable within all zones
*/
-unsigned int nr_free_pagecache_pages(void)
+unsigned long nr_free_pagecache_pages(void)
{
return nr_free_zone_pages(gfp_zone(GFP_HIGHUSER_MOVABLE));
}
--
1.7.1
--
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] 8+ messages in thread
* [PATCH 2/7] ia64: use %ld to print pages calculated in nr_free_buffer_pages
2013-02-06 5:11 [PATCH 0/7] mm: fix types for some functions and variables in case of overflow Zhang Yanfei
2013-02-06 5:15 ` [PATCH 1/7] mm: fix return type for functions nr_free_*_pages Zhang Yanfei
@ 2013-02-06 5:16 ` Zhang Yanfei
2013-02-06 5:17 ` [PATCH 3/7] fs/buffer.c: change type of max_buffer_heads to unsigned long Zhang Yanfei
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Zhang Yanfei @ 2013-02-06 5:16 UTC (permalink / raw)
To: Andrew Morton, mgorman, minchan, kamezawa.hiroyu
Cc: Linux MM, linux-kernel@vger.kernel.org
Now the function nr_free_buffer_pages returns unsigned long, so
use %ld to print its return value.
Signed-off-by: Zhang Yanfei <zhangyanfei@cn.fujitsu.com>
---
arch/ia64/mm/contig.c | 2 +-
arch/ia64/mm/discontig.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/ia64/mm/contig.c b/arch/ia64/mm/contig.c
index 1516d1d..80dab50 100644
--- a/arch/ia64/mm/contig.c
+++ b/arch/ia64/mm/contig.c
@@ -93,7 +93,7 @@ void show_mem(unsigned int filter)
printk(KERN_INFO "%d pages swap cached\n", total_cached);
printk(KERN_INFO "Total of %ld pages in page table cache\n",
quicklist_total_size());
- printk(KERN_INFO "%d free buffer pages\n", nr_free_buffer_pages());
+ printk(KERN_INFO "%ld free buffer pages\n", nr_free_buffer_pages());
}
diff --git a/arch/ia64/mm/discontig.c b/arch/ia64/mm/discontig.c
index c641333..b8a8fa3 100644
--- a/arch/ia64/mm/discontig.c
+++ b/arch/ia64/mm/discontig.c
@@ -666,7 +666,7 @@ void show_mem(unsigned int filter)
printk(KERN_INFO "%d pages swap cached\n", total_cached);
printk(KERN_INFO "Total of %ld pages in page table cache\n",
quicklist_total_size());
- printk(KERN_INFO "%d free buffer pages\n", nr_free_buffer_pages());
+ printk(KERN_INFO "%ld free buffer pages\n", nr_free_buffer_pages());
}
/**
--
1.7.1
--
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] 8+ messages in thread
* [PATCH 3/7] fs/buffer.c: change type of max_buffer_heads to unsigned long
2013-02-06 5:11 [PATCH 0/7] mm: fix types for some functions and variables in case of overflow Zhang Yanfei
2013-02-06 5:15 ` [PATCH 1/7] mm: fix return type for functions nr_free_*_pages Zhang Yanfei
2013-02-06 5:16 ` [PATCH 2/7] ia64: use %ld to print pages calculated in nr_free_buffer_pages Zhang Yanfei
@ 2013-02-06 5:17 ` Zhang Yanfei
2013-02-06 5:18 ` [PATCH 4/7] fs/nfsd: change type of max_delegations, nfsd_drc_max_mem and nfsd_drc_mem_used Zhang Yanfei
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Zhang Yanfei @ 2013-02-06 5:17 UTC (permalink / raw)
To: Andrew Morton, mgorman, minchan, kamezawa.hiroyu
Cc: Linux MM, linux-kernel@vger.kernel.org
max_buffer_heads is calculated from nr_free_buffer_pages(), so
change its type to unsigned long in case of overflow.
Signed-off-by: Zhang Yanfei <zhangyanfei@cn.fujitsu.com>
---
fs/buffer.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/buffer.c b/fs/buffer.c
index 7a75c3e..3eb675b 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -3227,7 +3227,7 @@ static struct kmem_cache *bh_cachep __read_mostly;
* Once the number of bh's in the machine exceeds this level, we start
* stripping them in writeback.
*/
-static int max_buffer_heads;
+static unsigned long max_buffer_heads;
int buffer_heads_over_limit;
@@ -3343,7 +3343,7 @@ EXPORT_SYMBOL(bh_submit_read);
void __init buffer_init(void)
{
- int nrpages;
+ unsigned long nrpages;
bh_cachep = kmem_cache_create("buffer_head",
sizeof(struct buffer_head), 0,
--
1.7.1
--
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] 8+ messages in thread
* [PATCH 4/7] fs/nfsd: change type of max_delegations, nfsd_drc_max_mem and nfsd_drc_mem_used
2013-02-06 5:11 [PATCH 0/7] mm: fix types for some functions and variables in case of overflow Zhang Yanfei
` (2 preceding siblings ...)
2013-02-06 5:17 ` [PATCH 3/7] fs/buffer.c: change type of max_buffer_heads to unsigned long Zhang Yanfei
@ 2013-02-06 5:18 ` Zhang Yanfei
2013-02-06 5:19 ` [PATCH 5/7] vmscan: change type of vm_total_pages to unsigned long Zhang Yanfei
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Zhang Yanfei @ 2013-02-06 5:18 UTC (permalink / raw)
To: Andrew Morton, mgorman, minchan, kamezawa.hiroyu, bfields
Cc: Linux MM, linux-kernel@vger.kernel.org
The three variables are calculated from nr_free_buffer_pages so
change their types to unsigned long in case of overflow.
Signed-off-by: Zhang Yanfei <zhangyanfei@cn.fujitsu.com>
---
fs/nfsd/nfs4state.c | 6 +++---
fs/nfsd/nfsd.h | 6 +++---
fs/nfsd/nfssvc.c | 6 +++---
3 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index ac8ed96..499e957 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -151,7 +151,7 @@ get_nfs4_file(struct nfs4_file *fi)
}
static int num_delegations;
-unsigned int max_delegations;
+unsigned long max_delegations;
/*
* Open owner state (share locks)
@@ -700,8 +700,8 @@ static int nfsd4_get_drc_mem(int slotsize, u32 num)
num = min_t(u32, num, NFSD_MAX_SLOTS_PER_SESSION);
spin_lock(&nfsd_drc_lock);
- avail = min_t(int, NFSD_MAX_MEM_PER_SESSION,
- nfsd_drc_max_mem - nfsd_drc_mem_used);
+ avail = min((unsigned long)NFSD_MAX_MEM_PER_SESSION,
+ nfsd_drc_max_mem - nfsd_drc_mem_used);
num = min_t(int, num, avail / slotsize);
nfsd_drc_mem_used += num * slotsize;
spin_unlock(&nfsd_drc_lock);
diff --git a/fs/nfsd/nfsd.h b/fs/nfsd/nfsd.h
index de23db2..07a473f 100644
--- a/fs/nfsd/nfsd.h
+++ b/fs/nfsd/nfsd.h
@@ -56,8 +56,8 @@ extern struct svc_version nfsd_version2, nfsd_version3,
extern u32 nfsd_supported_minorversion;
extern struct mutex nfsd_mutex;
extern spinlock_t nfsd_drc_lock;
-extern unsigned int nfsd_drc_max_mem;
-extern unsigned int nfsd_drc_mem_used;
+extern unsigned long nfsd_drc_max_mem;
+extern unsigned long nfsd_drc_mem_used;
extern const struct seq_operations nfs_exports_op;
@@ -106,7 +106,7 @@ static inline int nfsd_v4client(struct svc_rqst *rq)
* NFSv4 State
*/
#ifdef CONFIG_NFSD_V4
-extern unsigned int max_delegations;
+extern unsigned long max_delegations;
void nfs4_state_init(void);
int nfsd4_init_slabs(void);
void nfsd4_free_slabs(void);
diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c
index cee62ab..be7af50 100644
--- a/fs/nfsd/nfssvc.c
+++ b/fs/nfsd/nfssvc.c
@@ -59,8 +59,8 @@ DEFINE_MUTEX(nfsd_mutex);
* nfsd_drc_pages_used tracks the current version 4.1 DRC memory usage.
*/
spinlock_t nfsd_drc_lock;
-unsigned int nfsd_drc_max_mem;
-unsigned int nfsd_drc_mem_used;
+unsigned long nfsd_drc_max_mem;
+unsigned long nfsd_drc_mem_used;
#if defined(CONFIG_NFSD_V2_ACL) || defined(CONFIG_NFSD_V3_ACL)
static struct svc_stat nfsd_acl_svcstats;
@@ -342,7 +342,7 @@ static void set_max_drc(void)
>> NFSD_DRC_SIZE_SHIFT) * PAGE_SIZE;
nfsd_drc_mem_used = 0;
spin_lock_init(&nfsd_drc_lock);
- dprintk("%s nfsd_drc_max_mem %u \n", __func__, nfsd_drc_max_mem);
+ dprintk("%s nfsd_drc_max_mem %lu \n", __func__, nfsd_drc_max_mem);
}
static int nfsd_get_default_max_blksize(void)
--
1.7.1
--
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] 8+ messages in thread
* [PATCH 5/7] vmscan: change type of vm_total_pages to unsigned long
2013-02-06 5:11 [PATCH 0/7] mm: fix types for some functions and variables in case of overflow Zhang Yanfei
` (3 preceding siblings ...)
2013-02-06 5:18 ` [PATCH 4/7] fs/nfsd: change type of max_delegations, nfsd_drc_max_mem and nfsd_drc_mem_used Zhang Yanfei
@ 2013-02-06 5:19 ` Zhang Yanfei
2013-02-06 5:20 ` [PATCH 6/7] net: change type of netns_ipvs->sysctl_sync_qlen_max Zhang Yanfei
2013-02-06 5:21 ` [PATCH 7/7] net: change type of virtio_chan->p9_max_pages Zhang Yanfei
6 siblings, 0 replies; 8+ messages in thread
From: Zhang Yanfei @ 2013-02-06 5:19 UTC (permalink / raw)
To: Andrew Morton, mgorman, minchan, kamezawa.hiroyu
Cc: Linux MM, linux-kernel@vger.kernel.org
This variable is calculated from nr_free_pagecache_pages so
change its type to unsigned long.
Signed-off-by: Zhang Yanfei <zhangyanfei@cn.fujitsu.com>
---
include/linux/swap.h | 2 +-
mm/vmscan.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/linux/swap.h b/include/linux/swap.h
index c238323..fa1f686 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -266,7 +266,7 @@ extern unsigned long mem_cgroup_shrink_node_zone(struct mem_cgroup *mem,
extern unsigned long shrink_all_memory(unsigned long nr_pages);
extern int vm_swappiness;
extern int remove_mapping(struct address_space *mapping, struct page *page);
-extern long vm_total_pages;
+extern unsigned long vm_total_pages;
#ifdef CONFIG_NUMA
extern int zone_reclaim_mode;
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 196709f..5344a5b 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -128,7 +128,7 @@ struct scan_control {
* From 0 .. 100. Higher means more swappy.
*/
int vm_swappiness = 60;
-long vm_total_pages; /* The total number of pages which the VM controls */
+unsigned long vm_total_pages; /* The total number of pages which the VM controls */
static LIST_HEAD(shrinker_list);
static DECLARE_RWSEM(shrinker_rwsem);
--
1.7.1
--
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] 8+ messages in thread
* [PATCH 6/7] net: change type of netns_ipvs->sysctl_sync_qlen_max
2013-02-06 5:11 [PATCH 0/7] mm: fix types for some functions and variables in case of overflow Zhang Yanfei
` (4 preceding siblings ...)
2013-02-06 5:19 ` [PATCH 5/7] vmscan: change type of vm_total_pages to unsigned long Zhang Yanfei
@ 2013-02-06 5:20 ` Zhang Yanfei
2013-02-06 5:21 ` [PATCH 7/7] net: change type of virtio_chan->p9_max_pages Zhang Yanfei
6 siblings, 0 replies; 8+ messages in thread
From: Zhang Yanfei @ 2013-02-06 5:20 UTC (permalink / raw)
To: Andrew Morton, mgorman, minchan, kamezawa.hiroyu, wensong, horms,
ja
Cc: Linux MM, linux-kernel@vger.kernel.org
This member of struct netns_ipvs is calculated from nr_free_buffer_pages
so change its type to unsigned long in case of overflow.
Signed-off-by: Zhang Yanfei <zhangyanfei@cn.fujitsu.com>
---
include/net/ip_vs.h | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h
index 68c69d5..66e6c01 100644
--- a/include/net/ip_vs.h
+++ b/include/net/ip_vs.h
@@ -966,7 +966,7 @@ struct netns_ipvs {
int sysctl_snat_reroute;
int sysctl_sync_ver;
int sysctl_sync_ports;
- int sysctl_sync_qlen_max;
+ unsigned long sysctl_sync_qlen_max;
int sysctl_sync_sock_size;
int sysctl_cache_bypass;
int sysctl_expire_nodest_conn;
--
1.7.1
--
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] 8+ messages in thread
* [PATCH 7/7] net: change type of virtio_chan->p9_max_pages
2013-02-06 5:11 [PATCH 0/7] mm: fix types for some functions and variables in case of overflow Zhang Yanfei
` (5 preceding siblings ...)
2013-02-06 5:20 ` [PATCH 6/7] net: change type of netns_ipvs->sysctl_sync_qlen_max Zhang Yanfei
@ 2013-02-06 5:21 ` Zhang Yanfei
6 siblings, 0 replies; 8+ messages in thread
From: Zhang Yanfei @ 2013-02-06 5:21 UTC (permalink / raw)
To: Andrew Morton, mgorman, minchan, kamezawa.hiroyu, davem
Cc: Linux MM, linux-kernel@vger.kernel.org
This member of struct virtio_chan is calculated from nr_free_buffer_pages
so change its type to unsigned long in case of overflow.
Signed-off-by: Zhang Yanfei <zhangyanfei@cn.fujitsu.com>
---
net/9p/trans_virtio.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/net/9p/trans_virtio.c b/net/9p/trans_virtio.c
index fd05c81..de2e950 100644
--- a/net/9p/trans_virtio.c
+++ b/net/9p/trans_virtio.c
@@ -87,7 +87,7 @@ struct virtio_chan {
/* This is global limit. Since we don't have a global structure,
* will be placing it in each channel.
*/
- int p9_max_pages;
+ unsigned long p9_max_pages;
/* Scatterlist: can be too big for stack. */
struct scatterlist sg[VIRTQUEUE_NUM];
--
1.7.1
--
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] 8+ messages in thread