Skip to content

schbench: Avoid zero-page backed memory for matrices#12

Open
punitagrawal wants to merge 1 commit intomasoncl:mainfrom
punitagrawal:fix-cache-footprint
Open

schbench: Avoid zero-page backed memory for matrices#12
punitagrawal wants to merge 1 commit intomasoncl:mainfrom
punitagrawal:fix-cache-footprint

Conversation

@punitagrawal
Copy link

Schbench uses matrix multiplication to model the cache footprint of cpu-bound phase of a query processing workload.

The matrix buffers are allocated during setup and then used uninitialised. The kernel initially backs such pages with the global read-only zero page until they are faulted in and written.

In the workload, the result matrix is read and written, but the operand matrices are read-only. As a result, the operand pages remain mapped to the same zero-page, collapsing the working set and producing a much smaller cache footprint than requested.

Fix this by allocating matrix memory with mmap() and prefaulting it using MAP_POPULATE so operand pages are instantiated and the cache footprint matches the configured size.

Schbench uses matrix multiplication to model the cache footprint of
cpu-bound phase of a query processing workload.

The matrix buffers are allocated during setup and then used
uninitialised. The kernel initially backs such pages with the global
read-only zero page until they are faulted in and written.

In the workload, the result matrix is read and written, but the
operand matrices are read-only. As a result, the operand pages remain
mapped to the same zero-page, collapsing the working set and producing
a much smaller cache footprint than requested.

Fix this by allocating matrix memory with mmap() and prefaulting it
using `MAP_POPULATE` so operand pages are instantiated and the cache
footprint matches the configured size.

Signed-off-by: Punit Agrawal <punit.agrawal@oss.qualcomm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant