Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752614AbdGZOaB (ORCPT ); Wed, 26 Jul 2017 10:30:01 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55614 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751769AbdGZOTY (ORCPT ); Wed, 26 Jul 2017 10:19:24 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 7D73DC0B2C4F Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=aarcange@redhat.com Date: Wed, 26 Jul 2017 16:19:22 +0200 From: Andrea Arcangeli To: Prakash Sangappa Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-api@vger.kernel.org, rppt@linux.vnet.ibm.com, akpm@linux-foundation.org, mike.kravetz@oracle.com Subject: Re: [RESEND PATCH 1/2] userfaultfd: Add feature to request for a signal delivery Message-ID: <20170726141922.GV29716@redhat.com> References: <1500958062-953846-1-git-send-email-prakash.sangappa@oracle.com> <1500958062-953846-2-git-send-email-prakash.sangappa@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1500958062-953846-2-git-send-email-prakash.sangappa@oracle.com> User-Agent: Mutt/1.8.3 (2017-05-23) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Wed, 26 Jul 2017 14:19:24 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2090 Lines: 42 On Tue, Jul 25, 2017 at 12:47:41AM -0400, Prakash Sangappa wrote: > In some cases, userfaultfd mechanism should just deliver a SIGBUS signal > to the faulting process, instead of the page-fault event. Dealing with > page-fault event using a monitor thread can be an overhead in these > cases. For example applications like the database could use the signaling > mechanism for robustness purpose. > > Database uses 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 mmapped and accessed by many processes as shared memory. > The database keeps track of which offsets in the hugetlbfs file have > pages allocated. > > Any access to mapped address over holes in the file, which can occur due > to bugs in the application, is considered invalid and expect the process > to simply receive a SIGBUS. However, currently when a hole in the file is > accessed via the mapped address, kernel/mm attempts to automatically > allocate a page at page fault time, resulting in implicitly filling the > hole in the file. This may not be the desired behavior for applications > like the database that want to explicitly manage page allocations of > hugetlbfs files. > > Using userfaultfd mechanism with this support to get a signal, database > application can prevent pages from being allocated implicitly when > processes access mapped address over holes in the file. > > This patch adds UFFD_FEATURE_SIGBUS feature to userfaultfd mechnism to > request for a SIGBUS signal. > > See following for previous discussion about the database requirement > leading to this proposal as suggested by Andrea. > > http://www.spinics.net/lists/linux-mm/msg129224.html > > Signed-off-by: Prakash Sangappa > --- > fs/userfaultfd.c | 3 +++ > include/uapi/linux/userfaultfd.h | 10 +++++++++- > 2 files changed, 12 insertions(+), 1 deletions(-) Reviewed-by: Andrea Arcangeli