Linux Test Project
 help / color / mirror / Atom feed
From: Wake Liu via ltp <ltp@lists.linux.it>
To: ltp@lists.linux.it
Cc: kaleshsingh@google.com
Subject: [LTP] [PATCH 0/4] Don't derive kernel granularities from getpagesize()
Date: Wed, 11 Nov 2026 09:31:47 +0000	[thread overview]
Message-ID: <20261111093151.374731-1-wakel@google.com> (raw)

Hi,

Several tests derive kernel internal granularities from getpagesize():
the size of a pipe buffer, the granularity memory is faulted in and
cached with, or the page size reported by PROCMAP_QUERY. On mainline
kernels all of these are the same value, so the assumption never shows.

Android runs LTP on x86_64 emulators that boot a 4K kernel with the
page size emulation of the Android Common Kernels [1], enabled by
page_shift=14 on the kernel command line. It is not part of mainline.
The kernel reports a 16K page size to userspace through AT_PAGESZ and
enforces 16K alignment for mmap() and friends, while it keeps using 4K
pages internally. Interfaces that userspace commonly relies on, such as
mincore() and /proc/pid/pagemap, are emulated as well, but pipe
buffers, page fault, page cache and memcg accounting granularity, and
the KernelPageSize reported in smaps and by PROCMAP_QUERY keep
reflecting the real 4K kernel page size.

Android has carried local workarounds for these tests so far. This
series instead makes the tests rely on what the kernel reports, or
populate memory independently of the page size, so that Android can run
them unmodified. The patches are grouped by the assumption they remove.
None of them alters the behavior on kernels where both page sizes are
equal, and none adds emulation specific code to the tests.

Tested on:
- x86_64 with a 4K page size (Debian, 7.1 kernel), where epoll_wait06,
  ioctl10 and signal06 pass before and after the series, and all
  changed tests compile without warnings with gcc and clang.
- An Android x86_64 emulator with a 4K page size (6.6 kernel), where
  the results are the same before and after the series.
- An Android x86_64 Cuttlefish device running 6.18.32-android17 with
  page_shift=14, where all of the patched tests fail without the series
  and pass with it.

Changes to pipe2_04 and msync04 for the same setup alter what those
tests check, so I will send them separately.

[1] https://source.android.com/docs/core/architecture/16kb-page-size/getting-started-cf-x86-64-pgagnostic

Wake Liu (4):
  epoll_wait06, fcntl35: Don't assume a pipe buffer is getpagesize()
  memcg, userfaultfd07: Populate whole pages instead of single bytes
  ioctl10: Compare vma_page_size with KernelPageSize from smaps
  signal06: Allocate the alternate signal stack with mmap()

 .../controllers/memcg/control/mem_process.c   | 11 +++---
 .../kernel/controllers/memcg/memcontrol02.c   | 13 +++----
 .../kernel/syscalls/epoll_wait/epoll_wait06.c | 15 +++++---
 testcases/kernel/syscalls/fcntl/fcntl35.c     | 20 ++++++++++-
 testcases/kernel/syscalls/ioctl/ioctl10.c     | 34 ++++++++++++++++++-
 testcases/kernel/syscalls/signal/signal06.c   | 15 +++++---
 .../syscalls/userfaultfd/userfaultfd07.c      | 11 ++++--
 7 files changed, 95 insertions(+), 24 deletions(-)


base-commit: 0ee0ca5460402f6219df4da3e28b7c4aa4b8207d
-- 
2.56.0.567.gdb80ae8cd5-goog


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

             reply	other threads:[~2026-11-11  9:32 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-11  9:31 Wake Liu via ltp [this message]
2026-11-11  9:31 ` [LTP] [PATCH 1/4] epoll_wait06, fcntl35: Don't assume a pipe buffer is getpagesize() Wake Liu via ltp
2026-11-11  9:31 ` [LTP] [PATCH 2/4] memcg, userfaultfd07: Populate whole pages instead of single bytes Wake Liu via ltp
2026-11-11  9:31 ` [LTP] [PATCH 3/4] ioctl10: Compare vma_page_size with KernelPageSize from smaps Wake Liu via ltp
2026-11-11  9:31 ` [LTP] [PATCH 4/4] signal06: Allocate the alternate signal stack with mmap() Wake Liu via ltp

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261111093151.374731-1-wakel@google.com \
    --to=ltp@lists.linux.it \
    --cc=kaleshsingh@google.com \
    --cc=wakel@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox