Re: set_page_dirty vs set_page_dirty_lock

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Quoting Nick Piggin <[email protected]>:
> OK, yeah if a thread in the parent process writes into the buffer, then
> yes this would leave the copy in the parent AFAIKS.
> 
> But this is going to do similar weird stuff when racing with
> copy_to_user
> with ethernet recvmsg, is it not? (and direct-io and probably others).

FWIW, I think that copy_to_user will work correctly since it keeps the mmap
semaphore for the duration of the copy.
Direct-io might have the same problem.

> As such, I don't think it would be something you in particular need to
> worry about.
> 
> I guess to solve it, we could either retain mmap_sem for the duration to
> prevent fork,

Since this is the receive side, the DMA can take an indefinite
time to arrive. Isnt this a problem if we keep the mmap_sem?

> or try to do something tricky with page_count to determine
> if we need to do a copy in fork() rather than a COW.

I'm actually reasonably happy with the trick that I'm using:
performing a second get_user_pages after DMA and comparing
the page lists.
However, doing this every time on the off chance that a
page was made COW forces me into task context, every time.

-- 
MST
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux