kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
* newly add MAP_SYNC flag to mmap
       [not found] <611029344.5431951.1531789051542.ref@mail.yahoo.com>
@ 2018-07-17  0:57 ` David Frank
  2018-07-17  2:04   ` valdis.kletnieks at vt.edu
  0 siblings, 1 reply; 6+ messages in thread
From: David Frank @ 2018-07-17  0:57 UTC (permalink / raw)
  To: kernelnewbies

Hi, 
I installed LTS 18.04 with headers.? I'm trying to use the new flag MAP_SYNC with mmap call, but it complained MAP_SYNC undefined.What #define do I need to enable this?

Thanks,
David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20180717/8eebbb66/attachment.html>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* newly add MAP_SYNC flag to mmap
  2018-07-17  0:57 ` newly add MAP_SYNC flag to mmap David Frank
@ 2018-07-17  2:04   ` valdis.kletnieks at vt.edu
  2018-07-17  2:15     ` David Frank
  0 siblings, 1 reply; 6+ messages in thread
From: valdis.kletnieks at vt.edu @ 2018-07-17  2:04 UTC (permalink / raw)
  To: kernelnewbies

On Tue, 17 Jul 2018 00:57:31 -0000, David Frank said:

> I installed LTS 18.04 with headers.? I'm trying to use the new flag MAP_SYNC
> with mmap call, but it complained MAP_SYNC undefined.What #define do I need to
> enable this?

You need more than a #define. You need a 4.15 kernel and matching
kernel-headers. But if you installed 18.04 correctly, those should be in place
already, as that apparently shipped with 4.15...

Or if you're not really a kernel person, but a misplaced userspace person,
'man 2 mmap' tells us:

NAME
       mmap, munmap - map or unmap files or devices into memory

SYNOPSIS
       #include <sys/mman.h>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 486 bytes
Desc: not available
URL: <http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20180716/98a32b85/attachment.sig>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* newly add MAP_SYNC flag to mmap
  2018-07-17  2:04   ` valdis.kletnieks at vt.edu
@ 2018-07-17  2:15     ` David Frank
  2018-07-17  2:27       ` valdis.kletnieks at vt.edu
  0 siblings, 1 reply; 6+ messages in thread
From: David Frank @ 2018-07-17  2:15 UTC (permalink / raw)
  To: kernelnewbies

 Thanks Valdis.
Yes, I got the kernel and header files installed.
But there seems to be a lot of mman.h. I found one in /usr/include/asm-generic that defined MAP_SYNC, and I included it also, now I got passed compile and linking. I'm checking out if the flag does what is is said to do-- I don't have to call msync function, which would boost performance.

    On Monday, July 16, 2018, 10:04:54 PM EDT, <valdis.kletnieks@vt.edu> wrote:  
 
 On Tue, 17 Jul 2018 00:57:31 -0000, David Frank said:

> I installed LTS 18.04 with headers.? I'm trying to use the new flag MAP_SYNC
> with mmap call, but it complained MAP_SYNC undefined.What #define do I need to
> enable this?

You need more than a #define. You need a 4.15 kernel and matching
kernel-headers. But if you installed 18.04 correctly, those should be in place
already, as that apparently shipped with 4.15...

Or if you're not really a kernel person, but a misplaced userspace person,
'man 2 mmap' tells us:

NAME
? ? ? mmap, munmap - map or unmap files or devices into memory

SYNOPSIS
? ? ? #include <sys/mman.h>_______________________________________________
Kernelnewbies mailing list
Kernelnewbies at kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20180717/68dc919d/attachment.html>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* newly add MAP_SYNC flag to mmap
  2018-07-17  2:15     ` David Frank
@ 2018-07-17  2:27       ` valdis.kletnieks at vt.edu
  2018-07-17  3:16         ` David Frank
  0 siblings, 1 reply; 6+ messages in thread
From: valdis.kletnieks at vt.edu @ 2018-07-17  2:27 UTC (permalink / raw)
  To: kernelnewbies

On Tue, 17 Jul 2018 02:15:17 -0000, David Frank said:

> inking. I'm checking out if the flag does what is is said to do-- I don't have 
> to call msync function, which would boost performance.

Note that this can actually *kill* performance, because this means that the
kernel has to flush to backing store every single time it notes a change,
whereas if you use msync only at those points your software needs a sync point,
it can do it at only those points....

Thought experiment:  Imagine a workflow that needs to checkpoint every 1000
changes to the shared segment (for instance, if you've mapped an array with
1000 rows, do a for() loop across it incrementing one item, and checkpoint when
they're all incremented).  msync after the loop completes is one sync, while a worst-case
using MAP_SYNC could result in a flush after every single increment (if the system
is rescheduling the process over and over - for instance, if there's also another
syscall inside the loop).

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 486 bytes
Desc: not available
URL: <http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20180716/c7883f9a/attachment-0001.sig>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* newly add MAP_SYNC flag to mmap
  2018-07-17  2:27       ` valdis.kletnieks at vt.edu
@ 2018-07-17  3:16         ` David Frank
  0 siblings, 0 replies; 6+ messages in thread
From: David Frank @ 2018-07-17  3:16 UTC (permalink / raw)
  To: kernelnewbies

 Right.? That makes sense.?
    On Monday, July 16, 2018, 7:27:18 PM PDT, valdis.kletnieks at vt.edu <valdis.kletnieks@vt.edu> wrote:  
 
 On Tue, 17 Jul 2018 02:15:17 -0000, David Frank said:

> inking. I'm checking out if the flag does what is is said to do-- I don't have 
> to call msync function, which would boost performance.

Note that this can actually *kill* performance, because this means that the
kernel has to flush to backing store every single time it notes a change,
whereas if you use msync only at those points your software needs a sync point,
it can do it at only those points....

Thought experiment:? Imagine a workflow that needs to checkpoint every 1000
changes to the shared segment (for instance, if you've mapped an array with
1000 rows, do a for() loop across it incrementing one item, and checkpoint when
they're all incremented).? msync after the loop completes is one sync, while a worst-case
using MAP_SYNC could result in a flush after every single increment (if the system
is rescheduling the process over and over - for instance, if there's also another
syscall inside the loop).
_______________________________________________
Kernelnewbies mailing list
Kernelnewbies at kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20180717/ba8a66ce/attachment.html>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* newly add MAP_SYNC flag to mmap
@ 2018-07-17  2:25 Alex Arvelaez
  0 siblings, 0 replies; 6+ messages in thread
From: Alex Arvelaez @ 2018-07-17  2:25 UTC (permalink / raw)
  To: kernelnewbies

16.07.2018 10:15 PM David Frank <david_frank95@yahoo.com> napisa?(a):
>
> Thanks Valdis.
>
> Yes, I got the kernel and header files installed.
>
> But there seems to be a lot of mman.h. I found one in /usr/include/asm-generic that defined MAP_SYNC, and I included it also, now I got passed compile and linking.

I feel like your toolchain should be able to pick up the right file when you do #include <sys/mman.h>

Regards,

Alex
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20180717/80de40de/attachment.html>

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-07-17  3:16 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <611029344.5431951.1531789051542.ref@mail.yahoo.com>
2018-07-17  0:57 ` newly add MAP_SYNC flag to mmap David Frank
2018-07-17  2:04   ` valdis.kletnieks at vt.edu
2018-07-17  2:15     ` David Frank
2018-07-17  2:27       ` valdis.kletnieks at vt.edu
2018-07-17  3:16         ` David Frank
2018-07-17  2:25 Alex Arvelaez

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 NNTP newsgroup(s).