Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp9524576rwl; Wed, 11 Jan 2023 06:50:05 -0800 (PST) X-Google-Smtp-Source: AMrXdXvh2O4fAQwWC+j5C5hCJfD6oiK6vrZCicJR8Bjl1aVjTqaWcDITyksJzlqaPHnLzYPlaTs/ X-Received: by 2002:a17:902:f784:b0:192:b5a8:3eb6 with SMTP id q4-20020a170902f78400b00192b5a83eb6mr39155099pln.44.1673448605643; Wed, 11 Jan 2023 06:50:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673448605; cv=none; d=google.com; s=arc-20160816; b=myFplJUI2sx7tMXZddtFqwhXq9jIbsjM5u3F3F+lLAUSCuXufLKllv4z/B4ycuBpYQ P23LTsNtk5weef4Z1wRNbfgsvhpU+T2XrctBpXOvO+g+YO3+dqPn/ho1/jKj7eT+QaHT WTz1pbfGb+EuUZuvQht59AcSaZUwgfAEOlUFvAej0w1Nf00vWil+HxTGCOD3/OUC3Uhk i2XzjX8uEknBsV11ZOZiBS7zRTjdZM/TbMd9b/WUX/4yO4PAnbnxzVpMtnlH14aGemoY jlNR7VOm2gt23lhnvoMir7H3fsDfmNLeq0MWnwlOr7BA6v9PRJJeuf2FklU1Vl4ubG+X 0mpA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:message-id:in-reply-to :date:references:subject:cc:to:from:dkim-signature; bh=D39vXs2S/RnD+0E957Hp9KWXJdKMxGL7vQt2Nff943s=; b=G9GCpCBZUTHDZEPWOVY54zElFYjzyA+5bfXEKZQYdL966vl27o9FiEQBB4x1VtOgNN sPZo5bN/BlKzEE7gs0Peiq7kl1XH5mqSw1WRjVUD0p7680Icckh54dUXmT2IjFch6eke 0AwOsNGDw7KsLD0U2abRRkWPsUqL3xgLqtOodJuVR7VV0K1d242GUULc0PzyVO8YghbP aI5cHfXM0JiB94zEtldLPsPXE6U+IWu14E2lwOq2cXI4v7dKuJlA/u4+m/BaidBPQFiJ n9keYMzKUXbhq7kyff6+or6DGK79CkXGjbO/RBQ+lC88C9LvclfkHIZcnYEqmYSbcBId Onjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=NKIz3jnT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s9-20020a17090302c900b001928d16bf5csi14297622plk.21.2023.01.11.06.49.58; Wed, 11 Jan 2023 06:50:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=NKIz3jnT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S234394AbjAKOKo (ORCPT + 53 others); Wed, 11 Jan 2023 09:10:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54034 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230523AbjAKOKe (ORCPT ); Wed, 11 Jan 2023 09:10:34 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6D4E1BFC for ; Wed, 11 Jan 2023 06:09:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1673446190; 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=D39vXs2S/RnD+0E957Hp9KWXJdKMxGL7vQt2Nff943s=; b=NKIz3jnTXxiai1NsvyWJzWw19fYOfuvFxX6kZIeyZWIb/E4ACRMLMEWR8wjydyHfvFEW5w psLHhymOBs4/+ny01u6/x16hU5EUQ/G1Iw7YTilc4gd1ScytWJhRpHDhKk8CnauSh5kI24 gz9rO180x0qzJU8MoyLNXSkwu/IrGBA= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-79-dRM8KxJOMLKSMShZsFKKig-1; Wed, 11 Jan 2023 09:09:45 -0500 X-MC-Unique: dRM8KxJOMLKSMShZsFKKig-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7C96A380662D; Wed, 11 Jan 2023 14:09:43 +0000 (UTC) Received: from segfault.boston.devel.redhat.com (segfault.boston.devel.redhat.com [10.19.60.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 47570140EBF4; Wed, 11 Jan 2023 14:09:43 +0000 (UTC) From: Jeff Moyer To: Al Viro Cc: "Fabio M. De Francesco" , Benjamin LaHaise , linux-aio@kvack.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, "Venkataramanan\, Anirudh" , Ira Weiny Subject: Re: [PATCH v2] fs/aio: Replace kmap{,_atomic}() with kmap_local_page() References: <20230109175629.9482-1-fmdefrancesco@gmail.com> X-PGP-KeyID: 1F78E1B4 X-PGP-CertKey: F6FE 280D 8293 F72C 65FD 5A58 1FF8 A7CA 1F78 E1B4 Date: Wed, 11 Jan 2023 09:13:40 -0500 In-Reply-To: (Al Viro's message of "Wed, 11 Jan 2023 00:11:48 +0000") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Scanned-By: MIMEDefang 3.1 on 10.11.54.7 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, Al, Al Viro writes: > On Mon, Jan 09, 2023 at 06:56:29PM +0100, Fabio M. De Francesco wrote: > >> - ring = kmap_atomic(ctx->ring_pages[0]); >> + ring = kmap_local_page(ctx->ring_pages[0]); >> ring->nr = nr_events; /* user copy */ >> ring->id = ~0U; >> ring->head = ring->tail = 0; >> @@ -575,7 +575,7 @@ static int aio_setup_ring(struct kioctx *ctx, unsigned int nr_events) >> ring->compat_features = AIO_RING_COMPAT_FEATURES; >> ring->incompat_features = AIO_RING_INCOMPAT_FEATURES; >> ring->header_length = sizeof(struct aio_ring); >> - kunmap_atomic(ring); >> + kunmap_local(ring); >> flush_dcache_page(ctx->ring_pages[0]); > > I wonder if it would be more readable as memcpy_to_page(), actually... I'm not sure I understand what you're suggesting. >> >> return 0; >> @@ -678,9 +678,9 @@ static int ioctx_add_table(struct kioctx *ctx, struct mm_struct *mm) >> * we are protected from page migration >> * changes ring_pages by ->ring_lock. >> */ >> - ring = kmap_atomic(ctx->ring_pages[0]); >> + ring = kmap_local_page(ctx->ring_pages[0]); >> ring->id = ctx->id; >> - kunmap_atomic(ring); >> + kunmap_local(ring); > > Incidentally, does it need flush_dcache_page()? Yes, good catch. Cheers, Jeff