Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752442AbdGFMKB (ORCPT ); Thu, 6 Jul 2017 08:10:01 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:49969 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752316AbdGFMKA (ORCPT ); Thu, 6 Jul 2017 08:10:00 -0400 Date: Thu, 6 Jul 2017 15:09:50 +0300 From: Mike Rapoport To: "prakash.sangappa" Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-api@vger.kernel.org, Andrea Arcangeli , Dave Hansen , Christoph Hellwig , Mike Kravetz , Michal Hocko Subject: Re: [RFC PATCH v2] userfaultfd: Add feature to request for a signal delivery References: <20170704182806.GB4070@rapoport-lnx> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) X-TM-AS-GCONF: 00 x-cbid: 17070612-0012-0000-0000-000005604149 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17070612-0013-0000-0000-000018D2B1E2 Message-Id: <20170706120949.GE9625@rapoport-lnx> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-07-06_05:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1703280000 definitions=main-1707060211 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1712 Lines: 42 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. > >> [ ... ] > >>+ * > >>+ * UFFD_FEATURE_SIGBUS feature means no page-fault > >>+ * (UFFD_EVENT_PAGEFAULT) event will be delivered, instead > >>+ * a SIGBUS signal will be sent to the faulting process. > >>+ * The application process can enable this behavior by adding > >>+ * it to uffdio_api.features. > >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. -- Sincerely yours, Mike.