Received: by 10.223.185.116 with SMTP id b49csp4684040wrg; Tue, 27 Feb 2018 00:22:13 -0800 (PST) X-Google-Smtp-Source: AH8x224okIXNltXof/LeMuL03boUG1TEc8PTzgqyRAfGJgO3Hso6r/FS6/xJzvU2Wwh0LgT9JP8E X-Received: by 2002:a17:902:9a85:: with SMTP id w5-v6mr13327082plp.417.1519719733801; Tue, 27 Feb 2018 00:22:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519719733; cv=none; d=google.com; s=arc-20160816; b=PJgdOsYWLCU7z9ZeyJXb84y8vPFNcFUjCkiLuLd0Eb5yozgpd7lRvL74HZ4H5WaeBc aPt5sZtx+b0DUqSdH3WWEsDhUKLvHTCCJkprl4A/y3JunEDiWR5M3HhFSrlwR7rYCAA8 9evHL/WJPZ0WCpu99/dd6OmHlu4bRRQ8Xo+ti3euWnVv8OfJsLl7maZ+Cee4FIwWVAl1 FOTKtZWJuuDKw8MbNPMKGn6BBVdhszsvG1kY+twNTqGYR1ntjXeHnKDjj0uVQgQnNEp7 9Hw4S8ZjQ4rTfcimfqMGxyMINMKefpZZJIKLF4oUId3axkoF3tTLIjRsum+wmIq85R9H m7lw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=GrzAuKRbuYRFvyN5XiBfA5XqX5D0pWrY0klVDIsdk8s=; b=pcFF9k+p7NH9M3Znwlg/X6HNhyBs7e8bXk6y0hWSilum8lLt03iVOvR46EvckqLXoM AlMcaOt37cCJmhOQcOF7VJ5N8Jezj8W7G64KjiASE9WMpUXZBgkMYXxqA4nhqUHgg/U2 enjd3bn2WSm4wydSkcnQTzkHhzIM0e0cS+hIoM+ysx48AsxrFI1cnvM0fQ86SOv79Jyq skEvAsgglaetJ/TNhY2qc/6F3g6egLw0DAN+0sJnkwRY25UH3e+m6opzlYOfL2BngSSB SwnD1CiMPUxT5Q3+JJkgmlKIi2tWq/VdMv7+d4gQSihVuMeR8xKhCsU8zD3hjBDdEqhi JYCg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v189si6703207pgd.414.2018.02.27.00.21.59; Tue, 27 Feb 2018 00:22:13 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752170AbeB0IUE (ORCPT + 99 others); Tue, 27 Feb 2018 03:20:04 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:34106 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752069AbeB0IUD (ORCPT ); Tue, 27 Feb 2018 03:20:03 -0500 Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w1R8JXIY084831 for ; Tue, 27 Feb 2018 03:20:02 -0500 Received: from e06smtp11.uk.ibm.com (e06smtp11.uk.ibm.com [195.75.94.107]) by mx0a-001b2d01.pphosted.com with ESMTP id 2gd1xcv5w4-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Tue, 27 Feb 2018 03:20:02 -0500 Received: from localhost by e06smtp11.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 27 Feb 2018 08:20:00 -0000 Received: from b06cxnps3074.portsmouth.uk.ibm.com (9.149.109.194) by e06smtp11.uk.ibm.com (192.168.101.141) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 27 Feb 2018 08:19:56 -0000 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w1R8JuPK262462; Tue, 27 Feb 2018 08:19:56 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 56AB111C064; Tue, 27 Feb 2018 08:12:50 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B890911C04C; Tue, 27 Feb 2018 08:12:48 +0000 (GMT) Received: from rapoport-lnx (unknown [9.148.8.77]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Tue, 27 Feb 2018 08:12:48 +0000 (GMT) Received: by rapoport-lnx (sSMTP sendmail emulation); Tue, 27 Feb 2018 10:19:53 +0200 From: Mike Rapoport To: Andrew Morton , Andrea Arcangeli Cc: Pavel Emelyanov , linux-mm , linux-api , lkml , crml , Mike Rapoport Subject: [PATCH 0/3] userfaultfd: non-cooperative: syncronous events Date: Tue, 27 Feb 2018 10:19:49 +0200 X-Mailer: git-send-email 2.7.4 X-TM-AS-GCONF: 00 x-cbid: 18022708-0040-0000-0000-00000438442A X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18022708-0041-0000-0000-000020DA6EEC Message-Id: <1519719592-22668-1-git-send-email-rppt@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2018-02-27_04:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1802270100 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, These patches add ability to generate userfaultfd events so that their processing will be synchronized with the non-cooperative thread that caused the event. In the non-cooperative case userfaultfd resumes execution of the thread that caused an event when the notification is read() by the uffd monitor. In some cases, like, for example, madvise(MADV_REMOVE), it might be desirable to keep the thread that caused the event suspended until the uffd monitor had the event handled to avoid races between the thread that caused the and userfaultfd ioctls. Theses patches extend the userfaultfd API with an implementation of UFFD_EVENT_REMOVE_SYNC that allows to keep the thread that triggered UFFD_EVENT_REMOVE until the uffd monitor would not wake it explicitly. Mike Rapoport (3): userfaultfd: introduce userfaultfd_init_waitqueue helper userfaultfd: non-cooperative: generalize wake key structure userfaultfd: non-cooperative: allow synchronous EVENT_REMOVE fs/userfaultfd.c | 191 +++++++++++++++++++++++++++++---------- include/uapi/linux/userfaultfd.h | 14 +++ 2 files changed, 158 insertions(+), 47 deletions(-) -- 2.7.4