From: Anthony I <foobar@altatus.com>
To: linux-mm@kvack.org
Subject: hugetlb_cow and tlb invalidation on x86
Date: Sat, 8 Mar 2014 00:03:05 +0100 [thread overview]
Message-ID: <CAM9z9z-ngrFwc-KvdUqWsY=b8jzuzzKDYbG+nd10h_y=NApOVA@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1459 bytes --]
Hi all,
Currently huge_ptep_clear_flush on x86 is a nop. How is dtlb invalidation
handled, for the copy-on-write cases on huge pages ?
I have actually verified that dtlb consistency is maintained with an
example code, under the following scenario:
- parent allocates a 2M hugepage (via mmap/MAP_HUGETLB), fills page with
some random data
- forks a child process
- clones a thread
(all parent, child and thread run on separate cores, pinned).
The child process as well as the thread, read the contents of the hugepage
(thus there is a dtlb entry at the core that the thread runs)
At a later point, parent writes into the page, thus inducing a CoW fault.
Since this is a hugepage, there is no tlb page flushing taking place (no
tlb-flushing IPIs). My assumption is that the thread would be now reading
from the physical page that belongs to the child after CoW, since the
parent pgtable pte is now pointing to a newly allocated page, but the core
executing the thread has not received any tlb invalidation interrupts (thus
it would be following the "old" tlb entry). Oddly enough, this does not
hold true (the thread can see the updated page).
Going through the intel devel manuals, I do not see how this would happen.
It does not seem that large pages are treated differently from 4K pages as
far as tlb invalidation goes.
Any ideas ? Does the kernel somehow manage this in a different way, or is
it an x86 thing that is non-obvious ?
Regards,
Anthony
[-- Attachment #2: Type: text/html, Size: 1569 bytes --]
reply other threads:[~2014-03-07 23:03 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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='CAM9z9z-ngrFwc-KvdUqWsY=b8jzuzzKDYbG+nd10h_y=NApOVA@mail.gmail.com' \
--to=foobar@altatus.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