From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B6C2CC54EBC for ; Wed, 11 Jan 2023 14:11:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233717AbjAKOKq (ORCPT ); Wed, 11 Jan 2023 09:10:46 -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 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