Re: Atomic mmap replacement

2024-12-18 Thread Ken Brown via Cygwin
On 12/18/2024 5:24 PM, Ken Brown via Cygwin wrote: On 12/18/2024 1:35 PM, Corinna Vinschen via Cygwin wrote: On Dec 18 10:45, Ken Brown via Cygwin wrote: No, I'm still confused.  I thought that the interval determined by u_addr and u_len was the intersection of the requested interval and the w

Re: Atomic mmap replacement

2024-12-18 Thread Ken Brown via Cygwin
Please keep the discussion on the mailing list. On 12/18/2024 4:55 PM, matthew patton wrote: PLEASE put in a comment that the else case is testing the 'u_addr = addr' and that u_addr < addr is not possible given the logic in match. I HATE code that requires you to go digging around in multiple

Re: Atomic mmap replacement

2024-12-18 Thread Ken Brown via Cygwin
On 12/18/2024 1:35 PM, Corinna Vinschen via Cygwin wrote: On Dec 18 10:45, Ken Brown via Cygwin wrote: No, I'm still confused. I thought that the interval determined by u_addr and u_len was the intersection of the requested interval and the whole interval of the mmap_record; this implies u_addr

Re: Atomic mmap replacement

2024-12-18 Thread Corinna Vinschen via Cygwin
On Dec 18 10:45, Ken Brown via Cygwin wrote: > On 12/18/2024 9:28 AM, Corinna Vinschen via Cygwin wrote: > > Hi Ken, > > > > On Dec 17 15:23, Ken Brown via Cygwin wrote: > > > Hi Corinna, > > > > > > On 12/17/2024 11:38 AM, Corinna Vinschen via Cygwin wrote: > > > > Ideally a separate patch. If

Re: Atomic mmap replacement

2024-12-18 Thread Ken Brown via Cygwin
On 12/18/2024 9:28 AM, Corinna Vinschen via Cygwin wrote: Hi Ken, On Dec 17 15:23, Ken Brown via Cygwin wrote: Hi Corinna, On 12/17/2024 11:38 AM, Corinna Vinschen via Cygwin wrote: Ideally a separate patch. If you see a chance to send it to cygwin-patches this week, we can even merge it int

Re: Atomic mmap replacement

2024-12-18 Thread Corinna Vinschen via Cygwin
Hi Ken, On Dec 17 15:23, Ken Brown via Cygwin wrote: > Hi Corinna, > > On 12/17/2024 11:38 AM, Corinna Vinschen via Cygwin wrote: > > Ideally a separate patch. If you see a chance to send it to cygwin-patches > > this week, we can even merge it into 3.5.5, which I'm planning to release > > end o

Re: Atomic mmap replacement

2024-12-17 Thread Ken Brown via Cygwin
Hi Corinna, On 12/17/2024 11:38 AM, Corinna Vinschen via Cygwin wrote: Ideally a separate patch. If you see a chance to send it to cygwin-patches this week, we can even merge it into 3.5.5, which I'm planning to release end of this week (after that --> vacation :))) That should be no problem.

Re: Atomic mmap replacement

2024-12-17 Thread Corinna Vinschen via Cygwin
Hi Ken, On Dec 17 10:34, Ken Brown via Cygwin wrote: > On 12/16/2024 2:58 PM, Ken Brown via Cygwin wrote: > > On 12/16/2024 8:32 AM, Corinna Vinschen via Cygwin wrote: > > > Right now, mmaping with PROT_NONE and then re-mmaping with PROT_WRITE > > > doesn't work.  Cygwin implements PROT_NONE not a

Re: Atomic mmap replacement

2024-12-17 Thread Ken Brown via Cygwin
On 12/16/2024 2:58 PM, Ken Brown via Cygwin wrote: On 12/16/2024 8:32 AM, Corinna Vinschen via Cygwin wrote: Right now, mmaping with PROT_NONE and then re-mmaping with PROT_WRITE doesn't work.  Cygwin implements PROT_NONE not as MAP_RESERVE, but as MEM_COMMIT with PAGE_NOACCESS.  mmap() doesn't

Re: Atomic mmap replacement

2024-12-16 Thread Ken Brown via Cygwin
On 12/16/2024 8:32 AM, Corinna Vinschen via Cygwin wrote: Right now, mmaping with PROT_NONE and then re-mmaping with PROT_WRITE doesn't work. Cygwin implements PROT_NONE not as MAP_RESERVE, but as MEM_COMMIT with PAGE_NOACCESS. mmap() doesn't check if the requested pages are already allocated w

Re: Atomic mmap replacement

2024-12-16 Thread Corinna Vinschen via Cygwin
Hi Ken, On Dec 15 12:29, Ken Brown via Cygwin wrote: > On 12/14/2024 7:00 PM, Ken Brown via Cygwin wrote: > > Hi Corinna, > > > > On 2/19/2018 4:00 AM, Corinna Vinschen wrote: > > > On Feb 17 22:37, Ken Brown wrote: > > > > Some code in emacs wants to reserve a chunk of address space with a big >

Re: Atomic mmap replacement

2024-12-15 Thread Ken Brown via Cygwin
On 12/14/2024 7:00 PM, Ken Brown via Cygwin wrote: Hi Corinna, On 2/19/2018 4:00 AM, Corinna Vinschen wrote: On Feb 17 22:37, Ken Brown wrote: Some code in emacs wants to reserve a chunk of address space with a big PROT_NONE anonymous mapping, and then carve it up into separate mappings associ

Re: Atomic mmap replacement

2024-12-14 Thread Ken Brown via Cygwin
Hi Corinna, On 2/19/2018 4:00 AM, Corinna Vinschen wrote: On Feb 17 22:37, Ken Brown wrote: Some code in emacs wants to reserve a chunk of address space with a big PROT_NONE anonymous mapping, and then carve it up into separate mappings associated to segments of a file. This fails on Cygwin.

Re: Atomic mmap replacement

2018-02-20 Thread Corinna Vinschen
On Feb 19 20:03, John Hood wrote: > > > On 02/19/2018 12:19, Corinna Vinschen wrote: > > On second thought, we *could* do this, if the pages have been mmapped > > before(*). Unfortunately this would require a *major* revamp of the > > page handling in mmap. We would have to keep the mapping of

Re: Atomic mmap replacement

2018-02-20 Thread Corinna Vinschen
On Feb 19 17:33, Ken Brown wrote: > On 2/19/2018 12:19 PM, Corinna Vinschen wrote: > In the meantime, the problem was solved on the emacs side by doing what you > suggested in your previous email: > > > - unmap the old mapping > > - remap the unaffected parts as separate anonymous mapping > > - ma

Re: Atomic mmap replacement

2018-02-19 Thread John Hood
On 02/19/2018 12:19, Corinna Vinschen wrote: On second thought, we *could* do this, if the pages have been mmapped before(*). Unfortunately this would require a *major* revamp of the page handling in mmap. We would have to keep the mapping of every single 64K page separate. I.e., requesting

Re: Atomic mmap replacement

2018-02-19 Thread Ken Brown
On 2/19/2018 12:19 PM, Corinna Vinschen wrote: On Feb 19 08:22, Ken Brown wrote: On 2/19/2018 4:00 AM, Corinna Vinschen wrote: On Feb 17 22:37, Ken Brown wrote: Some code in emacs wants to reserve a chunk of address space with a big PROT_NONE anonymous mapping, and then carve it up into separa

Re: Atomic mmap replacement

2018-02-19 Thread Corinna Vinschen
On Feb 19 08:22, Ken Brown wrote: > On 2/19/2018 4:00 AM, Corinna Vinschen wrote: > > On Feb 17 22:37, Ken Brown wrote: > > > Some code in emacs wants to reserve a chunk of address space with a big > > > PROT_NONE anonymous mapping, and then carve it up into separate mappings > > > associated to se

Re: Atomic mmap replacement

2018-02-19 Thread Ken Brown
On 2/19/2018 4:00 AM, Corinna Vinschen wrote: On Feb 17 22:37, Ken Brown wrote: Some code in emacs wants to reserve a chunk of address space with a big PROT_NONE anonymous mapping, and then carve it up into separate mappings associated to segments of a file. This fails on Cygwin. Here's a test

Re: Atomic mmap replacement

2018-02-19 Thread Corinna Vinschen
On Feb 17 22:37, Ken Brown wrote: > Some code in emacs wants to reserve a chunk of address space with a big > PROT_NONE anonymous mapping, and then carve it up into separate mappings > associated to segments of a file. This fails on Cygwin. Here's a test case > that illustrates the problem: > >

Atomic mmap replacement

2018-02-17 Thread Ken Brown
Some code in emacs wants to reserve a chunk of address space with a big PROT_NONE anonymous mapping, and then carve it up into separate mappings associated to segments of a file. This fails on Cygwin. Here's a test case that illustrates the problem: $ truncate -s 64k foo $ cat mmap_test.c #