Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp1612022pxb; Fri, 27 Aug 2021 12:59:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyVTvK+MfJ4OSQM9z8KxpEzuHpQC2KPKzFBhdZG9hvu7suC0kj22JudLt7ArDwsM7fFYAkm X-Received: by 2002:a17:906:c7d8:: with SMTP id dc24mr284636ejb.365.1630094354298; Fri, 27 Aug 2021 12:59:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630094354; cv=none; d=google.com; s=arc-20160816; b=IG4oRFtdVAaG+yRESna+rBk2lMMxwWN7KJM0ne9h1JUNeYmrEAD7q6ph7D0jGgXu4j NT35GAO9hADRVHI3X7OlOOOksQTO8Y45IDMnkOpW5QSqMIDQd6WJPOwFNq/kB0qGyrN7 HR65L1xJIFLdeewybeFT/Wh7Q4gH8HqLqNrMaXlzaCgIFD/dqJXEI0iMrb1TzvrVckZk wDVLcQunV0WkmmnXUl1dwx9m3Reb3eFBHOTZTYc0KQtz1ek5AGWAv80SBdGQMIbIXqDC dfSA/iTAZeeHz6RFrw+dujXJof8yH06Y5xqj+Es1Ng8zeL+eXI035iXNtj7RXC9XoJ8Z CX/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=sd/3n0607wJTjqztLgFnu0bOLL0OQcH0TvNvy1LbLr8=; b=OTfw0ZpQMTUfaIUsHNZxOD7ouq5G7+gCE6uBSsqYQuTP+95PWhYl9ETKvUPxx8VFUF rKW8c5cU4gGAx60F0fqyMYLUk3tvyy5IoVUDUX1IWfAA1KQc8wR+K5c3Ve+e2/EynQ7Q cwzdaGs1H9PnDTm7Sqad6TuVYlFfX+VXeMOX/zqYts0IZxUtiClW/0kX6m5oLlNx9L0s 44L9ge3vxFgC824PXOVqH168NyRB3NGXAky/yi0i94GLwS0DF1Z1I5J4PNbbI2IHLc3a bWE8Vya+HDGDL3zeQy6PA8N8lYJ9NNC1mnFiaPaabJyht4Srpd4mAWywwvc4XhRHz7ME UzrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=SHj+3ue+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id v12si6275492ejv.679.2021.08.27.12.58.50; Fri, 27 Aug 2021 12:59:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=SHj+3ue+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S231529AbhH0T5P (ORCPT + 99 others); Fri, 27 Aug 2021 15:57:15 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:40882 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231320AbhH0T5P (ORCPT ); Fri, 27 Aug 2021 15:57:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1630094185; 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=sd/3n0607wJTjqztLgFnu0bOLL0OQcH0TvNvy1LbLr8=; b=SHj+3ue+PHmRxrG6E0hgpSIfIL42eS2WIKZcBZP5WZRHYdMmOlSe97vo+zIgNdrZFsvahA 9PeevwDg597Iev6nPFEWVTxjGIxHehriQQye81kMgGWkyWG0CB4HFUlJeys/JwSl8+4SXi gLbTqqbvg6P/4mbfsQiV/HI8GM7+m+E= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-549-Gk_zVumnM3qh5lwMUXg-Sw-1; Fri, 27 Aug 2021 15:56:24 -0400 X-MC-Unique: Gk_zVumnM3qh5lwMUXg-Sw-1 Received: by mail-wm1-f69.google.com with SMTP id y24-20020a7bcd98000000b002eb50db2b62so885386wmj.5 for ; Fri, 27 Aug 2021 12:56:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=sd/3n0607wJTjqztLgFnu0bOLL0OQcH0TvNvy1LbLr8=; b=YtoKbg16Y3tbh/nM1rdFPm6XryfS2cNI11GK/vWDEJKfqHaUqK+ErKcwUd4ZjIKlhG liiyOpCV6QjNhakVbxHKHa0DkJ70cCnV9dv1UcUqpbQy0cIjD2A8BBzh+eCVEDsZi1Lo vffWYITZlU+ixCLKnIryBnS4W/a8aLkFcK1tiEwYIXPwu4AsTwDgt63fuvh20L52eqOc nR1kpMucptLszrc8AGmt9lJKrvoPLJifOETxLO5StYM9M7crM4ZHMd6aj8h8hozHA9mI sXCU+/O/Y9UPDW9QEUMkvzCchlPAL0G5x1w4OGgBMffXltZpY8cKQNTExUwBUmW0SVQT 2nMw== X-Gm-Message-State: AOAM5303cDXPZxZ9C4AhlI90eOW62JYrvY9s6ygHc475g8Um9k+wYeTy zCYM/Dd0E0ojtSYK6UX0DJBIrXNZui3HvVgZkwOICwbm5+QXnQCz+v9hWcTsfJ7aE1itv531z3p 507QlY/CAc3wCMvxTWsdEAZcn645VLb++CXYrGYB5 X-Received: by 2002:a5d:47a4:: with SMTP id 4mr12104533wrb.329.1630094182742; Fri, 27 Aug 2021 12:56:22 -0700 (PDT) X-Received: by 2002:a5d:47a4:: with SMTP id 4mr12104517wrb.329.1630094182497; Fri, 27 Aug 2021 12:56:22 -0700 (PDT) MIME-Version: 1.0 References: <20210827164926.1726765-1-agruenba@redhat.com> <20210827164926.1726765-19-agruenba@redhat.com> In-Reply-To: From: Andreas Gruenbacher Date: Fri, 27 Aug 2021 21:56:10 +0200 Message-ID: Subject: Re: [PATCH v7 18/19] iov_iter: Introduce nofault flag to disable page faults To: Al Viro Cc: Linus Torvalds , Christoph Hellwig , "Darrick J. Wong" , Jan Kara , Matthew Wilcox , cluster-devel , linux-fsdevel , LKML , ocfs2-devel@oss.oracle.com Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Aug 27, 2021 at 8:47 PM Al Viro wrote: > On Fri, Aug 27, 2021 at 06:49:25PM +0200, Andreas Gruenbacher wrote: > > Introduce a new nofault flag to indicate to get_user_pages to use the > > FOLL_NOFAULT flag. This will cause get_user_pages to fail when it > > would otherwise fault in a page. > > > > Currently, the noio flag is only checked in iov_iter_get_pages and > > iov_iter_get_pages_alloc. This is enough for iomaop_dio_rw, but it > > may make sense to check in other contexts as well. > > I can live with that, but > * direct assignments (as in the next patch) are fucking hard to > grep for. Is it intended to be "we set it for duration of primitive", > or...? It's for this kind of pattern: pagefault_disable(); to->nofault = true; ret = iomap_dio_rw(iocb, to, &gfs2_iomap_ops, NULL, IOMAP_DIO_PARTIAL, written); to->nofault = false; pagefault_enable(); Clearing the flag at the end isn't strictly necessary, but it kind of documents that the flag pertains to iomap_dio_rw and not something else. > * it would be nice to have a description of intended semantics > for that thing. This "may make sense to check in other contexts" really > needs to be elaborated (and agreed) upon. Details, please. Maybe the description should just be something like: "Introduce a new nofault flag to indicate to iov_iter_get_pages not to fault in user pages. This is implemented by passing the FOLL_NOFAULT flag to get_user_pages, which causes get_user_pages to fail when it would otherwise fault in a page. We'll use the ->nofault flag to prevent iomap_dio_rw from faulting in pages when page faults are not allowed." Thanks, Andreas