mm/msync: Use offset_in_page macro
Subsystems (6)
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/10 mm/msync: Use offset_in_page macro
The <linux/mm.h> provides offset_in_page() macro. Let's use already predefined macro instead of (addr & ~PAGE_MASK).
--- mm/msync.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/msync.c +1 -1
@@ -38,7 +38,7 @@ SYSCALL_DEFINE3(msync, unsigned long, start, size_t, len, int, flags)if (flags & ~(MS_ASYNC |MS_INVALIDATE |MS_SYNC )) goto out; -if (start & ~PAGE_MASK ) +if (offset_in_page (start)) goto out;if ((flags &MS_ASYNC ) && (flags &MS_SYNC )) goto out;
Signature · 7 lines
2.5.0 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
PATCH 2/10 mm/nommu: Use offset_in_page macro
In reply to a message not in the archiveThe <linux/mm.h> provides offset_in_page() macro. Let's use already predefined macro instead of (addr & ~PAGE_MASK).
--- mm/nommu.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
mm/nommu.c +4 -4
@@ -1497,7 +1497,7 @@ SYSCALL_DEFINE1(old_mmap, struct mmap_arg_struct __user *, arg)if (copy_from_user (&a, arg,sizeof (a)))return -EFAULT ; -if (a.offset & ~PAGE_MASK ) +if (offset_in_page (a.offset))return -EINVAL ; return sys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, a.fd,
@@ -1653,9 +1653,9 @@ int do_munmap(struct mm_struct *mm, unsigned long start, size_t len) goto erase_whole_vma;if (start < vma->vm_start || end > vma->vm_end)return -EINVAL ; -if (start & ~PAGE_MASK ) +if (offset_in_page (start))return -EINVAL ; -if (end != vma->vm_end && end & ~PAGE_MASK ) +if (end != vma->vm_end &&offset_in_page (end))return -EINVAL ;if (start != vma->vm_start && end != vma->vm_end) { ret =split_vma (mm, vma, start,1 );
@@ -1736,7 +1736,7 @@ static unsigned long do_mremap(unsigned long addr,if (old_len ==0 || new_len ==0 )return (unsigned long ) -EINVAL ; -if (addr & ~PAGE_MASK ) +if (offset_in_page (addr))return -EINVAL ;if (flags &MREMAP_FIXED && new_addr != addr)
Signature · 7 lines
2.5.0 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
PATCH 3/10 mm/mincore: Use offset_in_page macro
In reply to a message not in the archiveThe <linux/mm.h> provides offset_in_page() macro. Let's use already predefined macro instead of (addr & ~PAGE_MASK).
--- mm/mincore.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/mincore.c +1 -1
@@ -234,8 +234,7 @@ SYSCALL_DEFINE3(mincore, unsigned long, start, size_t, len,/* This also avoids any overflows on PAGE_CACHE_ALIGN */ pages = len >>PAGE_SHIFT ; - pages += (len & ~PAGE_MASK ) !=0 ; + pages += (offset_in_page (len)) !=0 ;if (!access_ok (VERIFY_WRITE , vec, pages))return -EFAULT ;
Signature · 7 lines
2.5.0 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
PATCH 4/10 mm/early_ioremap: Use offset_in_page macro
In reply to a message not in the archiveThe <linux/mm.h> provides offset_in_page() macro. Let's use already predefined macro instead of (addr & ~PAGE_MASK).
--- mm/early_ioremap.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
mm/early_ioremap.c +3 -3
@@ -126,7 +126,7 @@ __early_ioremap(resource_size_t phys_addr, unsigned long size, pgprot_t prot)/* * Mappings have to be page-aligned */ - offset = phys_addr & ~PAGE_MASK ; + offset =offset_in_page (phys_addr); phys_addr &=PAGE_MASK ; size =PAGE_ALIGN (last_addr +1 ) - phys_addr;
@@ -189,7 +189,7 @@ void __init early_iounmap(void __iomem *addr, unsigned long size)if (WARN_ON (virt_addr <fix_to_virt (FIX_BTMAP_BEGIN )))return ; - offset = virt_addr & ~PAGE_MASK ; + offset =offset_in_page (virt_addr); nrpages =PAGE_ALIGN (offset + size) >>PAGE_SHIFT ; idx =FIX_BTMAP_BEGIN -NR_FIX_BTMAPS *slot;
@@ -234,7 +234,7 @@ void __init copy_from_early_mem(void *dest, phys_addr_t src, unsigned long size)char *p;while (size) { - slop = src & ~PAGE_MASK ; + slop =offset_in_page (src); clen = size;if (clen >MAX_MAP_CHUNK - slop) clen =MAX_MAP_CHUNK - slop;
Signature · 7 lines
2.5.0 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
PATCH 5/10 mm/percpu: Use offset_in_page macro
In reply to a message not in the archiveThe <linux/mm.h> provides offset_in_page() macro. Let's use already predefined macro instead of (addr & ~PAGE_MASK).
--- mm/percpu.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
mm/percpu.c +5 -5
@@ -1554,12 +1554,12 @@ int __init pcpu_setup_first_chunk(const struct pcpu_alloc_info *ai,PCPU_SETUP_BUG_ON (ai->nr_groups <=0 );#ifdef CONFIG_SMP PCPU_SETUP_BUG_ON (!ai->static_size); -PCPU_SETUP_BUG_ON ((unsigned long )__per_cpu_start & ~PAGE_MASK ); +PCPU_SETUP_BUG_ON (offset_in_page (__per_cpu_start));#endif PCPU_SETUP_BUG_ON (!base_addr); -PCPU_SETUP_BUG_ON ((unsigned long )base_addr & ~PAGE_MASK ); +PCPU_SETUP_BUG_ON (offset_in_page (base_addr));PCPU_SETUP_BUG_ON (ai->unit_size < size_sum); -PCPU_SETUP_BUG_ON (ai->unit_size & ~PAGE_MASK ); +PCPU_SETUP_BUG_ON (offset_in_page (ai->unit_size));PCPU_SETUP_BUG_ON (ai->unit_size <PCPU_MIN_UNIT_SIZE );PCPU_SETUP_BUG_ON (ai->dyn_size <PERCPU_DYNAMIC_EARLY_SIZE );PCPU_SETUP_BUG_ON (pcpu_verify_alloc_info (ai) <0 );
@@ -1806,7 +1806,7 @@ static struct pcpu_alloc_info * __init pcpu_build_alloc_info( alloc_size =roundup (min_unit_size, atom_size); upa = alloc_size / min_unit_size; -while (alloc_size % upa || ((alloc_size / upa) & ~PAGE_MASK )) +while (alloc_size % upa || (offset_in_page (alloc_size / upa))) upa--; max_upa = upa;
@@ -1838,7 +1838,7 @@ static struct pcpu_alloc_info * __init pcpu_build_alloc_info(for (upa = max_upa; upa; upa--) {int allocs =0 , wasted =0 ; -if (alloc_size % upa || ((alloc_size / upa) & ~PAGE_MASK )) +if (alloc_size % upa || (offset_in_page (alloc_size / upa)))continue ;for (group =0 ; group < nr_groups; group++) {
Signature · 7 lines
2.5.0 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [PATCH 05/10] mm/percpu: Use offset_in_page macro
Quoted 4 lines · Alexander Kuleshov
The <
linux/mm.h> providesoffset_in_page()macro. Let's use already predefined macro instead of (addr & ~PAGE_MASK).Signed-off-by Alexander Kuleshov <[email protected]>
Please feel free to route with other patches.
Thanks.
Signature · 7 lines
tejun -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
PATCH 6/10 mm/util: Use offset_in_page macro
In reply to a message not in the archiveThe <linux/mm.h> provides offset_in_page() macro. Let's use already predefined macro instead of (addr & ~PAGE_MASK).
--- mm/util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/util.c +1 -1
@@ -309,7 +309,7 @@ unsigned long vm_mmap(struct file *file, unsigned long addr, {if (unlikely (offset +PAGE_ALIGN (len) < offset))return -EINVAL ; -if (unlikely (offset & ~PAGE_MASK )) +if (unlikely (offset_in_page (offset)))return -EINVAL ;return vm_mmap_pgoff (file, addr, len, prot, flag, offset >>PAGE_SHIFT );
Signature · 7 lines
2.5.0 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
PATCH 7/10 mm/mlock: Use offset_in_page macro
In reply to a message not in the archiveThe <linux/mm.h> provides offset_in_page() macro. Let's use already predefined macro instead of (addr & ~PAGE_MASK).
--- mm/mlock.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
mm/mlock.c +3 -3
@@ -560,7 +560,7 @@ static int do_mlock(unsigned long start, size_t len, int on)struct vm_area_struct * vma, * prev;int error; -VM_BUG_ON (start & ~PAGE_MASK ); +VM_BUG_ON (offset_in_page (start));VM_BUG_ON (len !=PAGE_ALIGN (len)); end = start + len;if (end < start)
@@ -616,7 +616,7 @@ SYSCALL_DEFINE2(mlock, unsigned long, start, size_t, len)lru_add_drain_all ();/* flush pagevec */ - len =PAGE_ALIGN (len + (start & ~PAGE_MASK )); + len =PAGE_ALIGN (len + (offset_in_page (start))); start &=PAGE_MASK ; lock_limit =rlimit (RLIMIT_MEMLOCK );
@@ -645,7 +645,7 @@ SYSCALL_DEFINE2(munlock, unsigned long, start, size_t, len) {int ret; - len =PAGE_ALIGN (len + (start & ~PAGE_MASK )); + len =PAGE_ALIGN (len + (offset_in_page (start))); start &=PAGE_MASK ;down_write (¤t->mm->mmap_sem);
Signature · 7 lines
2.5.0 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
PATCH 8/10 mm/vmalloc: Use offset_in_page macro
In reply to a message not in the archiveThe <linux/mm.h> provides offset_in_page() macro. Let's use already predefined macro instead of (addr & ~PAGE_MASK).
--- mm/vmalloc.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
mm/vmalloc.c +6 -6
@@ -358,7 +358,7 @@ static struct vmap_area *alloc_vmap_area(unsigned long size,struct vmap_area *first;BUG_ON (!size); -BUG_ON (size & ~PAGE_MASK ); +BUG_ON (offset_in_page (size));BUG_ON (!is_power_of_2 (align)); va = kmalloc_node(sizeof(struct vmap_area),
@@ -936,7 +936,7 @@ static void *vb_alloc(unsigned long size, gfp_t gfp_mask)void *vaddr =NULL ;unsigned int order; -BUG_ON (size & ~PAGE_MASK ); +BUG_ON (offset_in_page (size));BUG_ON (size >PAGE_SIZE *VMAP_MAX_ALLOC );if (WARN_ON (size ==0 )) {/*
@@ -989,7 +989,7 @@ static void vb_free(const void *addr, unsigned long size)unsigned int order;struct vmap_block *vb; -BUG_ON (size & ~PAGE_MASK ); +BUG_ON (offset_in_page (size));BUG_ON (size >PAGE_SIZE *VMAP_MAX_ALLOC );flush_cache_vunmap ((unsigned long )addr, (unsigned long )addr + size);
@@ -1902,7 +1902,7 @@ static int aligned_vread(char *buf, char *addr, unsigned long count)while (count) {unsigned long offset, length; - offset = (unsigned long )addr & ~PAGE_MASK ; + offset =offset_in_page (addr); length =PAGE_SIZE - offset;if (length > count) length = count;
@@ -1941,7 +1941,7 @@ static int aligned_vwrite(char *buf, char *addr, unsigned long count)while (count) {unsigned long offset, length; - offset = (unsigned long )addr & ~PAGE_MASK ; + offset =offset_in_page (addr); length =PAGE_SIZE - offset;if (length > count) length = count;
@@ -2392,7 +2392,7 @@ struct vm_struct **pcpu_get_vm_areas(const unsigned long *offsets,bool purged = false;/* verify parameters and allocate data structures */ -BUG_ON (align & ~PAGE_MASK || !is_power_of_2 (align)); +BUG_ON (offset_in_page (align) || !is_power_of_2 (align));for (last_area =0 , area =0 ; area < nr_vms; area++) { start = offsets[area]; end = start + sizes[area];
Signature · 7 lines
2.5.0 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
PATCH 9/10 mm/mmap: Use offset_in_page macro
In reply to a message not in the archiveThe <linux/mm.h> provides offset_in_page() macro. Let's use already predefined macro instead of (addr & ~PAGE_MASK).
--- mm/mmap.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
mm/mmap.c +6 -6
@@ -1304,7 +1304,7 @@ unsigned long do_mmap(struct file *file, unsigned long addr,* that it represents a valid section of the address space. */ addr =get_unmapped_area (file, addr, len, pgoff, flags); -if (addr & ~PAGE_MASK ) +if (offset_in_page (addr))return addr;/* Do simple checking here so the lower-level routines won't have
@@ -1475,7 +1475,7 @@ SYSCALL_DEFINE1(old_mmap, struct mmap_arg_struct __user *, arg)if (copy_from_user (&a, arg,sizeof (a)))return -EFAULT ; -if (a.offset & ~PAGE_MASK ) +if (offset_in_page (a.offset))return -EINVAL ; return sys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, a.fd,
@@ -1996,7 +1996,7 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0,* can happen with large stack limits and large mmap() * allocations. */ -if (addr & ~PAGE_MASK ) { +if (offset_in_page (addr)) {VM_BUG_ON (addr != -ENOMEM ); info.flags =0 ; info.low_limit =TASK_UNMAPPED_BASE ;
@@ -2032,7 +2032,7 @@ get_unmapped_area(struct file *file, unsigned long addr, unsigned long len,if (addr >TASK_SIZE - len)return -ENOMEM ; -if (addr & ~PAGE_MASK ) +if (offset_in_page (addr))return -EINVAL ; addr =arch_rebalance_pgtables (addr, len);
@@ -2543,7 +2543,7 @@ int do_munmap(struct mm_struct *mm, unsigned long start, size_t len)unsigned long end;struct vm_area_struct *vma, *prev, *last; -if ((start & ~PAGE_MASK ) || start >TASK_SIZE || len >TASK_SIZE -start) +if ((offset_in_page (start)) || start >TASK_SIZE || len >TASK_SIZE -start)return -EINVAL ; len =PAGE_ALIGN (len);
@@ -2741,7 +2741,7 @@ static unsigned long do_brk(unsigned long addr, unsigned long len) flags =VM_DATA_DEFAULT_FLAGS |VM_ACCOUNT | mm->def_flags; error =get_unmapped_area (NULL , addr, len,0 ,MAP_FIXED ); -if (error & ~PAGE_MASK ) +if (offset_in_page (error))return error; error =mlock_future_check (mm, mm->def_flags, len);
Signature · 7 lines
2.5.0 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
PATCH 10/10 mm/mremap: Use offset_in_page macro
In reply to a message not in the archiveThe <linux/mm.h> provides offset_in_page() macro. Let's use already predefined macro instead of (addr & ~PAGE_MASK).
--- mm/mremap.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
mm/mremap.c +6 -6
@@ -401,7 +401,7 @@ static unsigned long mremap_to(unsigned long addr, unsigned long old_len,unsigned long charged =0 ;unsigned long map_flags; -if (new_addr & ~PAGE_MASK ) +if (offset_in_page (new_addr)) goto out;if (new_len >TASK_SIZE || new_addr >TASK_SIZE - new_len)
@@ -435,11 +435,11 @@ static unsigned long mremap_to(unsigned long addr, unsigned long old_len, ret =get_unmapped_area (vma->vm_file, new_addr, new_len, vma->vm_pgoff + ((addr - vma->vm_start) >>PAGE_SHIFT ), map_flags); -if (ret & ~PAGE_MASK ) +if (offset_in_page (ret)) goto out1; ret =move_vma (vma, addr, old_len, new_len, new_addr, locked); -if (!(ret & ~PAGE_MASK )) +if (!(offset_in_page (ret))) goto out; out1:vm_unacct_memory (charged);
@@ -484,7 +484,7 @@ SYSCALL_DEFINE5(mremap, unsigned long, addr, unsigned long, old_len,if (flags &MREMAP_FIXED && !(flags &MREMAP_MAYMOVE ))return ret; -if (addr & ~PAGE_MASK ) +if (offset_in_page (addr))return ret; old_len =PAGE_ALIGN (old_len);
@@ -566,7 +566,7 @@ SYSCALL_DEFINE5(mremap, unsigned long, addr, unsigned long, old_len, vma->vm_pgoff + ((addr - vma->vm_start) >>PAGE_SHIFT ), map_flags); -if (new_addr & ~PAGE_MASK ) { +if (offset_in_page (new_addr)) { ret = new_addr; goto out; }
@@ -574,7 +574,7 @@ SYSCALL_DEFINE5(mremap, unsigned long, addr, unsigned long, old_len, ret =move_vma (vma, addr, old_len, new_len, new_addr, &locked); } out: -if (ret & ~PAGE_MASK ) { +if (offset_in_page (ret)) {vm_unacct_memory (charged); locked =0 ; }
Signature · 7 lines
2.5.0 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>