UPSTREAM: include/linux/mm.h: add PAGE_ALIGNED() helper
authorAndrew Morton <akpm@linux-foundation.org>
Wed, 3 Jul 2013 22:02:11 +0000 (15:02 -0700)
committerStricted <info@stricted.net>
Tue, 6 Aug 2019 11:33:34 +0000 (11:33 +0000)
To test whether an address is aligned to PAGE_SIZE.

Cc: HATAYAMA Daisuke <d.hatayama@jp.fujitsu.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>,
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
(cherry picked from commit 0fa73b86ef0797ca4fde5334117ca0b330f08030)

Bug: 36007193
Change-Id: I7e912bb0dbd8c9737fb13c5b48acb54ee39dd5fc

include/linux/mm.h

index cc9cdbc455e2fd30433b875be274227d3d4d3d1e..2896cb4c68f8ee96be124e6ef395226e161cc5d0 100644 (file)
@@ -63,6 +63,9 @@ extern unsigned long sysctl_admin_reserve_kbytes;
 /* to align the pointer to the (next) page boundary */
 #define PAGE_ALIGN(addr) ALIGN(addr, PAGE_SIZE)
 
+/* test whether an address (unsigned long or pointer) is aligned to PAGE_SIZE */
+#define PAGE_ALIGNED(addr)     IS_ALIGNED((unsigned long)addr, PAGE_SIZE)
+
 /*
  * Linux kernel virtual memory manager primitives.
  * The idea being to have a "virtual" mm in the same way