Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752456AbdGGUVg (ORCPT ); Fri, 7 Jul 2017 16:21:36 -0400 Received: from mail-qk0-f196.google.com ([209.85.220.196]:35070 "EHLO mail-qk0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751059AbdGGUVf (ORCPT ); Fri, 7 Jul 2017 16:21:35 -0400 From: Jon Pry To: LKML Cc: Jon Pry Subject: Re: [RFC PATCH v2] userfaultfd: Add feature to request for a signal delivery Date: Fri, 7 Jul 2017 16:21:07 -0400 Message-Id: <20170707202107.21461-1-jonpry@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170706120949.GE9625@rapoport-lnx> References: <20170706120949.GE9625@rapoport-lnx> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1994 Lines: 43 >On Wed, Jul 05, 2017 at 05:41:14PM -0700, prakash.sangappa wrote: >> On 07/04/2017 11:28 AM, Mike Rapoport wrote: >> >On Tue, Jun 27, 2017 at 09:08:40AM -0700, Prakash Sangappa wrote: >> >>Applications like the database use hugetlbfs for performance reason. >> >>Files on hugetlbfs filesystem are created and huge pages allocated >> >>using fallocate() API. Pages are deallocated/freed using fallocate() hole >> >>punching support. These files are mmap'ed and accessed by many >> >>single threaded processes as shared memory. The database keeps >> >>track of which offsets in the hugetlbfs file have pages allocated. >> >> [ ... ] >> >I think that it maybe worth making UFFD_FEATURE_SIGBUS mutually exclusive >> >with the non-cooperative events. There is no point of having monitor if the >> >page fault handler will anyway just kill the faulting process. >> >> >> Will this not be too restrictive?. The non-cooperative events could >> still be useful if an application wants to track changes >> to VA ranges that are registered even though it expects >> a signal on page fault. >I wouldn't say that we must make UFFD_FEATURE_SIGBUS mutually exclusive >with other events, but, IMHO, it's something we should at least think >about. >In my view, if you anyway have uffd monitor, you may process page faults >there as well and then there is no actual need in UFFD_FEATURE_SIGBUS. A use case for this I am considering, is lightweight threads/continuations having a context switch on the page faults of file backed VMA's. Some sort of asynchronous read() would then be initiated. For this case, the primary function of SIGBUS is to allow the thread to jump into context switch code. While it's not immediately clear what roll the uffd monitor thread would play in this. One can imagine the possibility of the UFFD thread also managing asynchronous i/o. Just wanted to voice my approval of this patch in general. It could enable some really cool userland technologies imho. ~Jon Pry