Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp9699184rwl; Wed, 11 Jan 2023 08:52:30 -0800 (PST) X-Google-Smtp-Source: AMrXdXtLjEaKBsDeb+zLdLTdiKGC0LBVEoLo2X+kwPzZZ9vGSrTaXh27B7t3E08tC1rCBxzrDt3m X-Received: by 2002:a62:e708:0:b0:583:2a2e:3465 with SMTP id s8-20020a62e708000000b005832a2e3465mr2957792pfh.1.1673455950011; Wed, 11 Jan 2023 08:52:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673455949; cv=none; d=google.com; s=arc-20160816; b=xxeE7S8DNSIPoXZt9eIGM+hgi4uuj/+EK81gAQu02QkhKzAuQr0uffGxL3VIsvnGZZ qGa/hRX7drFO1m+efZnf5QxU5xH1BzyzDy0pHzQEyiAHMAvRksaXP22r2Z0vH9W1FboB RYdBnujsWz5Ohuq7jK+07CFanaO+VH5JAG4oc1GbO7V41HKp+cR8mM8ZNclaNmDv668A A0LIXsNESLm7P2kAJTrY31SEOQIJZdHPZi5zQPQKUQ9VPxkrFnHbdOnW22PJmeJk8ipK l6cXtsgfQm+tCnEH7jSGWJqd+luekjMUvG88XAJoOOWjzXzXMlD4K7249AEiXLsylCCT V/aw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=efDFlg+yOf7f+QHekxkFqaFu7IzDmipcTvP18voo0xg=; b=rcg1iWoupaOfPZ/HXIHoZiCt//gxRZjBM1rGva/F3FbObWyWARgyFj79SHjz9dFrGo Bm5pNAXhqmTesaHltlhMqBhNNA9TpC9Dh3L6HiZo8NIk0U31ZH/rLUU9tM54KJ3MdbSQ vz43fQ+OV94KBcvs1bgiwvELjaPHgNpqZZaACMsD2vISmsbbBYC9MLTKS/VnTk7zKVZC 8yly/ExureMjPE1/VRrD7/ueh/toU26XLsGUYhrY2H/s+fX5pNhi6gG2v4KIp6eCSpDB BniZNfTdVDMZu0wyOcUJptTJv32e97WT6RtI+laHZ94EGQAJrskjqKiAamzuBOdv9+Fy kxow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.org.uk header.s=zeniv-20220401 header.b=nHk3+6DF; 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=zeniv.linux.org.uk Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f12-20020a056a0022cc00b0056be3585c3asi15550519pfj.266.2023.01.11.08.52.23; Wed, 11 Jan 2023 08:52:29 -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=@linux.org.uk header.s=zeniv-20220401 header.b=nHk3+6DF; 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=zeniv.linux.org.uk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235353AbjAKQCk (ORCPT + 51 others); Wed, 11 Jan 2023 11:02:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48666 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234315AbjAKQCe (ORCPT ); Wed, 11 Jan 2023 11:02:34 -0500 Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [IPv6:2a03:a000:7:0:5054:ff:fe1c:15ff]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 61190DFAD; Wed, 11 Jan 2023 08:02:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=linux.org.uk; s=zeniv-20220401; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=efDFlg+yOf7f+QHekxkFqaFu7IzDmipcTvP18voo0xg=; b=nHk3+6DFrTjYJgpsa2PRe+SndN 2Myzd1x/o3p9Pf7L2wTiQNAjYFoax1Rq7pyfPXMbw0+iibH4f2SjU/FFASPVl2Y7+tIcleGBq1ONa HEfgv4sHB4WpSnbp8RavAMELKr7lyo4S0QJL/EggtAPGXCZ7drhgOI2Y/Xx4R/CpwCIcojqCXo4C+ kzXs3CT6dO/uEAnekZMwqoKpSisDWZP+EX+gFcdMYcIwUmAG8QEJhVelh/ChTqzzQ5gzVOfccpiOi ssEUOomxggY4Wi6+/yxcp7htPEH9xvxTVsv0E6GN6RitOxAJWq3irOOes+P/s6OQ6umf5d8E1usGP 2vn6PKYw==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.96 #2 (Red Hat Linux)) id 1pFdYY-001KCi-12; Wed, 11 Jan 2023 16:02:26 +0000 Date: Wed, 11 Jan 2023 16:02:26 +0000 From: Al Viro To: Jeff Moyer 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() Message-ID: References: <20230109175629.9482-1-fmdefrancesco@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: Al Viro X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,SPF_HELO_NONE,SPF_NONE autolearn=ham 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 On Wed, Jan 11, 2023 at 09:13:40AM -0500, Jeff Moyer wrote: > 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. memcpy_to_page(ctx->ring_pages[0], 0, &(struct aio_ring){ .nr = nr_events, .id = ~0U, .magic = AIO_RING_MAGIC, .compat_features = AIO_RING_COMPAT_FEATURES, .in_compat_features = AIO_RING_INCOMPAT_FEATURES, .header_length = sizeof(struct aio_ring)}, sizeof(struct aio_ring)); instead of the lines from kmap_atomic to flush_dcache_page... > > >> > >> 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.