Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752029AbbEZUWs (ORCPT ); Tue, 26 May 2015 16:22:48 -0400 Received: from mail.phunq.net ([184.71.0.62]:36534 "EHLO starbase.phunq.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751184AbbEZUWo (ORCPT ); Tue, 26 May 2015 16:22:44 -0400 Message-ID: <5564D60E.6000306@phunq.net> Date: Tue, 26 May 2015 13:22:38 -0700 From: Daniel Phillips User-Agent: Mozilla/5.0 (X11; Linux i686; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: Jan Kara CC: David Lang , Rik van Riel , tux3@tux3.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, OGAWA Hirofumi Subject: Re: [FYI] tux3: Core changes References: <555D0FDF.3070303@phunq.net> <555D500B.4080901@phunq.net> <13c8bcdf-70e8-43d5-a05f-58ad839dbfd0@phunq.net> <5563F5C8.2040806@redhat.com> <67294911-1776-46b8-916d-0e5642a38725@phunq.net> <20150526070910.GA3307@quack.suse.cz> <20150526090058.GA8024@quack.suse.cz> In-Reply-To: <20150526090058.GA8024@quack.suse.cz> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2892 Lines: 60 On 05/26/2015 02:00 AM, Jan Kara wrote: > On Tue 26-05-15 01:08:56, Daniel Phillips wrote: >> On Tuesday, May 26, 2015 12:09:10 AM PDT, Jan Kara wrote: >>> E.g. video drivers (or infiniband or direct IO for that matter) which >>> have buffers in user memory (may be mmapped file), grab references to pages >>> and hand out PFNs of those pages to the hardware to store data in them... >>> If you fork a page after the driver has handed PFNs to the hardware, you've >>> just lost all the writes hardware will do. >> >> Hi Jan, >> >> The page forked because somebody wrote to it with write(2) or mmap write at >> the same time as a video driver (or infiniband or direct IO) was >> doing io to >> it. Isn't the application trying hard to lose data in that case? It >> would not need page fork to lose data that way. > > So I can think of two valid uses: > > 1) You setup IO to part of a page and modify from userspace a different > part of a page. Suppose the use case is reading textures from video memory into a mmapped file, and at the same time, the application is allowed to update the textures in the file via mmap or write(2). Fork happens at mkwrite time. If the page is already dirty, we do not fork it. The video API must have made the page writable and dirty, so I do not see an issue. > 2) At least for video drivers there is one ioctl() which creates object > with buffers in memory and another ioctl() to actually ship it to hardware > (may be called repeatedly). So in theory app could validly dirty the pages > before it ships them to hardware. If this happens repeatedly and interacts > badly with background writeback, you will end up with a forked page in a > buffer and from that point on things are broken. Writeback does not fork pages. An app may dirty a page that is in process of being shipped to hardware (must be a distinct part of the page, or it is a race) and the data being sent to hardware will not be disturbed. If there is an issue here, I do not see it. > So my opinion is: Don't fork the page if page_count is elevated. You can > just wait for the IO if you need stable pages in that case. It's slow but > it's safe and it should be pretty rare. Is there any problem with that? That would be our fallback if anybody discovers a specific case where page fork breaks something, which so far has not been demonstrated. With a known fallback, it is hard to see why we should delay merging over that. Perfection has never been a requirement for merging filesystems. On the contrary, imperfection is a reason for merging, so that the many eyeballs effect may prove its value. Regards, Daniel -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/