memory-util: Add PAGE_ALIGN_DOWN

For example, cgroup v2 rounds down to the previous page when returning
memory limits.
This commit is contained in:
Chris Down 2019-10-03 14:41:06 +01:00
parent 86e94d95d0
commit 3a6da69a93
1 changed files with 1 additions and 0 deletions

View File

@ -11,6 +11,7 @@
size_t page_size(void) _pure_;
#define PAGE_ALIGN(l) ALIGN_TO((l), page_size())
#define PAGE_ALIGN_DOWN(l) (l & ~(page_size() - 1))
/* Normal memcpy requires src to be nonnull. We do nothing if n is 0. */
static inline void memcpy_safe(void *dst, const void *src, size_t n) {