Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp2279359ybv; Fri, 14 Feb 2020 15:21:35 -0800 (PST) X-Google-Smtp-Source: APXvYqyy/jnntv9uNyc4lHOl3o//ylpsd4TQtVxf65PEz2XdTZPxDCKaDRCTVupd2JYw8BOYRHMd X-Received: by 2002:aca:1011:: with SMTP id 17mr3651456oiq.72.1581722495728; Fri, 14 Feb 2020 15:21:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581722495; cv=none; d=google.com; s=arc-20160816; b=PXaV7+Svk2TfL4RKj0EpXBKpGvuri90DjmOcYjCmjL7tn9jH4JpFs2gP4NwE7VJzV4 l/3ISRYg/YerQw2Kc1Q6g5/oBu7N2GrHg7adlOknc5oqHUsK6cjMAD/dWues/MOsgvf3 UuG8CPdcYCTa4KwtlHEC05WiBRCvFDICJU0pEw4jgMaNLUMuRl0CaJEzFKpTGGXhF6V2 jamZDFtJoIZP3zmgKI/KPeK5CmFi7gdWotl103r4O4D/lsYaGszxqHUO3jDoPlARiPQp MzpLmtcE8eyUgVj/euKXW6m2r6rO2ikQ6e1WAc8999vHQYJhGbVH1ZbbmtdPkdVIrNH7 2Ueg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=Z34VtLc1BYtNZqTBh3fQkOhafmRPIz9ekzq0qoyZ9B8=; b=W878IYhkmJP5bWAzvpkFonhSSwTNnyfghRyOx2r1ZkMJPnoLbt2j4mIvYPH0dHLwQv jVw3xiDdz38cldQkTO+MwU3Hj+VQiKKdmI5MMOMPgzdTUTyBaFApr9JcyswT+d5p/7mU ajtJQQyCFeUA5RG+6roGmCzLs+ttkYghwIGUEyoXSSnB///iBPHzy15N1WunGGP1FCIu NHeBXN1QRHYKMlLsOCnqzzyCfB4B+jd/v0HPps2PaihyzrtZk4MdHC95f+kv+7ltv9ej xPFhQhG9DnDnKOO81+KMrABRLkDK1AAAPP2dAlfXNTkduhXJfv+AKZH5CZ95elK5GLzO lCxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=aHgOYQHy; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u21si3141786oiv.267.2020.02.14.15.21.20; Fri, 14 Feb 2020 15:21:35 -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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=aHgOYQHy; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727932AbgBNXUJ (ORCPT + 99 others); Fri, 14 Feb 2020 18:20:09 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:35624 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727620AbgBNXUJ (ORCPT ); Fri, 14 Feb 2020 18:20:09 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1581722408; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Z34VtLc1BYtNZqTBh3fQkOhafmRPIz9ekzq0qoyZ9B8=; b=aHgOYQHy9Xq27TaJ81F9uDDp9gAYaqsJ/AIcMKhLRDrQ6ECuOdUSnvT7TzijThILC7wHqU JjtVw7v7NZZEBUCPOdnjat5igB7TUZ703OYgEqCERwMch1aeaQIT7DGkd3/nSMAcxF+u9I wNvr/OgFlNal4cCQa9OTTYxNyHQs9iU= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-395-o2pCaLhFOHaTGurnNWKV2g-1; Fri, 14 Feb 2020 18:20:00 -0500 X-MC-Unique: o2pCaLhFOHaTGurnNWKV2g-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B96578017CC; Fri, 14 Feb 2020 23:19:58 +0000 (UTC) Received: from mail (ovpn-120-118.rdu2.redhat.com [10.10.120.118]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1174A60BE1; Fri, 14 Feb 2020 23:19:56 +0000 (UTC) Date: Fri, 14 Feb 2020 18:19:54 -0500 From: Andrea Arcangeli To: Brian Geffon Cc: Andrew Morton , linux-mm , linux-kernel@vger.kernel.org, Mike Rapoport , Sonny Rao , "Kirill A . Shutemov" , Peter Xu Subject: Re: [RFC PATCH] userfaultfd: Address race after fault. Message-ID: <20200214231954.GA29849@redhat.com> References: <20200214225849.108108-1-bgeffon@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200214225849.108108-1-bgeffon@google.com> User-Agent: Mutt/1.13.1 (2019-12-14) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello, this and other enhancements have already implemented by Peter (CC'ed) and in the right way, by altering the retry logic in the page fault code. This is a requirement for other kind of usages too, notably the UFFD_WRITEPROTECT ioctl after which multiple consecutive faults can happen and must be handled. IIRC Kirill asked at last LSF-MM uffd-wp talk if there's any particular reason the fault couldn't be retried currently. I had no sure answer other than there's apparently no strong reason why VM_FAULT_RETRY is only allowed 1 time currently, so there should be no issue in lifting that artificial restriction. I'm running with this patchset applied in my systems since Nov with no regression at all. I got sidetracked by various other issues, so unfortunately I didn' post a proper reviewed-by on the last submit yet (pending), but I did at least test it and it was rock solid so far. https://lore.kernel.org/lkml/20190926093904.5090-1-peterx@redhat.com/ Can you test and verify it too if it solves your use case? Also note the complete uffd-WP support submit also from Peter: https://lore.kernel.org/lkml/20190620022008.19172-1-peterx@redhat.com/ https://github.com/xzpeter/linux/tree/uffd-wp-merged Thanks, Andrea