Skip to content

Commit 335e52c

Browse files
sulixrichardweinberger
authored andcommitted
mm: Add PAGE_ALIGN_DOWN macro
This is just the same as PAGE_ALIGN(), but rounds the address down, not up. Suggested-by: Dmitry Vyukov <[email protected]> Signed-off-by: David Gow <[email protected]> Acked-by: Andrew Morton <[email protected]> Signed-off-by: Richard Weinberger <[email protected]>
1 parent 9e70cbd commit 335e52c

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

include/linux/mm.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,9 @@ int overcommit_policy_handler(struct ctl_table *, int, void *, size_t *,
221221
/* to align the pointer to the (next) page boundary */
222222
#define PAGE_ALIGN(addr) ALIGN(addr, PAGE_SIZE)
223223

224+
/* to align the pointer to the (prev) page boundary */
225+
#define PAGE_ALIGN_DOWN(addr) ALIGN_DOWN(addr, PAGE_SIZE)
226+
224227
/* test whether an address (unsigned long or pointer) is aligned to PAGE_SIZE */
225228
#define PAGE_ALIGNED(addr) IS_ALIGNED((unsigned long)(addr), PAGE_SIZE)
226229

0 commit comments

Comments
 (0)