public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
To: DJ Delorie <dj@redhat.com>
Cc: libc-alpha@sourceware.org
Subject: Re: [v4] Update mmap() flags and errors lists
Date: Fri, 21 Jun 2024 12:20:48 -0400	[thread overview]
Message-ID: <9bb29d8c-9b23-412b-aabf-3a08e24d6857@efficios.com> (raw)
In-Reply-To: <xnwmmip8x3.fsf@greed.delorie.com>

On 2024-06-21 12:17, DJ Delorie wrote:
> Mathieu Desnoyers <mathieu.desnoyers@efficios.com> writes:
>>>>> +@item MAP_SYNC
>>>>> +This flag is used to map persistent memory devices into the running
>>>>> +program in such a way that writes to the mapping are immediately
>>>>> +written to the device as well.  Unlike most other flags, this one will
>>>>> +fail unless @code{MAP_SHARED_VALIDATE} is also given.
>>>>
>>>> Note that this wording is misleading. Users of persistent memory devices
>>>> need to issue explicit "flush" instructions to ensure that writes are
>>>> made persistent to the device. The MAP_SYNC merely guarantees that
>>>> memory mappings within a file on a dax-enabled filesystem will appear
>>>> at the same file offset after a crash/reboot. It goes not guarantee
>>>> anything about write persistence.
>>>
>>>     "This flag is supported only for files supporting DAX (direct mapping
>>>      of persistent memory)"
>>>
>>>     "it will be visible in the same file at the same offset even after the
>>>      system crashes or is rebooted."
>>>
>>> That sounds like persistence to me?
>>
>> AFAIU it states persistence of the mapping location within the file, but
>> it does not guarantee anything about persistence of the writes to that
>> mapping.
>>
>> In many cases, persistence of the writes to the mapping are only made
>> persistent after specific cache-flushing instructions have been issued.
>>
>> See this man page for reference:
>>
>> https://manpages.debian.org/experimental/libpmem-dev/pmem_flush.3
> 
> How about if I just say "This is a special flag for DAX devices." and
> not bother trying to be helpful?  ;-)
> 

That works for me.

> All the kernel does is write out dirty metadata whenever dirty data is
> written out, when the flag is set.

Exactly, it's affecting how the page fault handler populates the file
metadata before allowing user-space to see the newly populated page
AFAIU.

Thanks,

Mathieu


-- 
Mathieu Desnoyers
EfficiOS Inc.
https://www.efficios.com


  reply	other threads:[~2024-06-21 16:19 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-10 18:59 DJ Delorie
2024-06-04 22:16 ` Florian Weimer
2024-06-05  4:10   ` DJ Delorie
2024-06-05  6:38     ` Florian Weimer
2024-06-05 18:42       ` DJ Delorie
2024-06-14  8:14         ` Florian Weimer
2024-06-14 16:40           ` DJ Delorie
2024-06-05 18:50       ` [v3] " DJ Delorie
2024-06-14  8:21         ` Florian Weimer
2024-06-14 18:19           ` DJ Delorie
2024-06-14 18:46           ` [v4] " DJ Delorie
2024-06-18 20:13             ` Mathieu Desnoyers
2024-06-18 20:57               ` DJ Delorie
2024-06-21 13:02                 ` Mathieu Desnoyers
2024-06-21 16:17                   ` DJ Delorie
2024-06-21 16:20                     ` Mathieu Desnoyers [this message]
2024-06-19  7:16             ` Florian Weimer
2024-06-05  4:11   ` [v2] " DJ Delorie
2024-06-05  7:44     ` Andreas Schwab
2024-06-05 18:42       ` DJ Delorie

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=9bb29d8c-9b23-412b-aabf-3a08e24d6857@efficios.com \
    --to=mathieu.desnoyers@efficios.com \
    --cc=dj@redhat.com \
    --cc=libc-alpha@sourceware.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).