From: Ayaan Mirza Baig <ayaanmirzabaig85@gmail.com>
To: akpm@linux-foundation.org
Cc: linux-mm@kvack.org, david@redhat.com
Subject: [RFC] mm: Add MADV_NONZERO to skip redundant zeroing in MADV_DONTNEED
Date: Wed, 4 Jun 2025 06:31:59 +0530 [thread overview]
Message-ID: <ed44f504-64a5-4c64-ba99-7533e027e4c1@gmail.com> (raw)
Hi Andrew,
I've been looking at MADV_DONTNEED and noticed we always zero pages,
even when
it might not be necessary for cases like:
- Media buffers (video/audio processing)
- Temporary compute workloads
- Pre-zeroed memory pools
This causes measurable overhead - in some synthetic tests I'm seeing
~40% extra
latency from the zeroing. I'm thinking of adding a MADV_NONZERO flag
that would
let us skip the zeroing when:
1. It's explicitly requested (MADV_DONTNEED|MADV_NONZERO)
2. We're confident it's safe (VM_IO, VM_HUGETLB, etc)
3. The user has explicitly marked the region as non-sensitive
Before I go deeper on patches, I wanted to check:
- Does this sound reasonable?
- Any obvious security holes I'm missing?
- Would you prefer a new flag or a separate advice type?
Early prototype numbers look promising, but I want to make sure I'm not
missing
something fundamental. If the concept seems viable, I'll work up proper
benchmarks
and formal patches.
Thanks for your time!
- Ayaan Mirza Baig
next reply other threads:[~2025-06-04 1:02 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-04 1:01 Ayaan Mirza Baig [this message]
2025-06-04 1:49 ` [RFC] mm: Add MADV_NONZERO to skip redundant zeroing in MADV_DONTNEED Harry Yoo
2025-06-04 11:27 ` David Hildenbrand
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=ed44f504-64a5-4c64-ba99-7533e027e4c1@gmail.com \
--to=ayaanmirzabaig85@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=david@redhat.com \
--cc=linux-mm@kvack.org \
/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