From owner-freebsd-arch@freebsd.org Sat Aug 8 08:41:28 2015 Return-Path: Delivered-To: freebsd-arch@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B88289B3396 for ; Sat, 8 Aug 2015 08:41:28 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mailman.ysv.freebsd.org (mailman.ysv.freebsd.org [IPv6:2001:1900:2254:206a::50:5]) by mx1.freebsd.org (Postfix) with ESMTP id 9D0AB1997 for ; Sat, 8 Aug 2015 08:41:28 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: by mailman.ysv.freebsd.org (Postfix) id 9BF379B3395; Sat, 8 Aug 2015 08:41:28 +0000 (UTC) Delivered-To: arch@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 81EED9B3394 for ; Sat, 8 Aug 2015 08:41:28 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 29B7A1994; Sat, 8 Aug 2015 08:41:27 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id t788fLuN081072 (version=TLSv1 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Sat, 8 Aug 2015 11:41:22 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua t788fLuN081072 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id t788fLuD081071; Sat, 8 Aug 2015 11:41:21 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sat, 8 Aug 2015 11:41:21 +0300 From: Konstantin Belousov To: Gleb Smirnoff Cc: arch@FreeBSD.org, alc@freebsd.org Subject: Re: more strict KPI for vm_pager_get_pages() Message-ID: <20150808084121.GX2072@kib.kiev.ua> References: <20150430142408.GS546@nginx.com> <20150807133844.GS889@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150807133844.GS889@FreeBSD.org> User-Agent: Mutt/1.5.23 (2014-03-12) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Aug 2015 08:41:28 -0000 On Fri, Aug 07, 2015 at 04:38:44PM +0300, Gleb Smirnoff wrote: > Hi! > > This is followup on older email: > > https://lists.freebsd.org/pipermail/freebsd-arch/2015-April/017154.html > > The preparatory commits were already checked in, and I'm going > to push next week the rest, since the whole story is already > several months due. > > Planned changes: > > o vm_pager_get_pages() accepts array of pages, and treats all pages > equally. Notion of reqpage goes away. > o The array span validity must be checked before with vm_pager_has_page(). > o All pages must be xbusied on enter. > o All pages will be left xbusied on exit. This closes possible races, > allows to pass in wired pages (for any pager). And it leaves > the caller to decide what to do with pages: vm_page_active, > vm_page_deactivate, vm_page_flash or just vm_page_free them. > > The patch has been tested by me and pho@ with his stress2 test. > > I know, that there are two comments from kib@ on the patch. These were not comments, but objections. > > 1) There could be a user of KPI who would be fine with partial success. > > My answer: right now there is none, and if one emerges, the code can > be easily adopted to return VM_PAGER_ERROR, but still mark validated > pages as valid. The user of KPI then can scan the array and take valid > pages. So, the patch doesn't put any obstacles on appearance of such > user. The vm_fault.c is already fine with the partial success, it only cares that the requested page was validated and no error from pager is returned. > > 2) Filesystems can do short reads by design, and thus fail to validate > the entire array. > > My answer: yes, that's true. By design NFS, SMBFS and FUSE should be > able to return short reads. However, the VOP_GETPAGES methods for all > three FSes right now do not have any code that would support that. So, > it looks like there is an open issue with these filesystems, not related > to my patch. When this issue is addressed in any of aforementioned FSes, > the VOP_GETPAGES should be fixed to do several I/Os in case of short > reads. And this is a bug in the networking filesystems (most likely). Rick was asked about NFS, but he did not responded. You are proposing to make the bug a part of the interface. I object against this change. It is wrong philosophically, and it encodes the incomplete or accidental behaviour of several filesystems at the interface level. In fact, you are taking some rather secondary feature of the current interface, that the non-requested pages are made busy for the duration of the paging request, to the level of the fundamental property (would the non-mreq pages be not busied, proposed change immediately causes applications segfault on parallel file truncation, or makes user data corrupted, for example). All this rototilling is because you do not want to code the proper FSA in your reworked sendfile patch. I object against the change and against the reasoning behind it.