Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp10557763rwl; Mon, 2 Jan 2023 04:45:13 -0800 (PST) X-Google-Smtp-Source: AMrXdXu8XnpeiYOYYP8tQQVnD8VG13t5Y0K7+oLUoryovUqLUs95ddXtSMMi30mB8k+AhPSlPDwm X-Received: by 2002:a05:6402:1caa:b0:46c:72fb:3810 with SMTP id cz10-20020a0564021caa00b0046c72fb3810mr41521682edb.41.1672663513012; Mon, 02 Jan 2023 04:45:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672663512; cv=none; d=google.com; s=arc-20160816; b=b+miAiLDTLzUfvtdVP4L/+iaKLLJY2TMSErosizydS6WQmQnaT7pcyrlM1duYaI/CW Xg0sb059wcMK+oOWoK51wFoREYH/njgTzg2MnDo4VTm7AR1bSpQc9n5aIXu7m1mdD89G x9gTzr2zpLZaPGHyojXi6oa79h0n5xQMexKdOagOXh6wVqiNxHvU/IGy+KZC3f0l7Xjj V7oyQ6jwE8DVJY87q+NTA0nmGu9meMzBK7yhIfcb0UtuGDsjMPPgVB4UnABk+wbvbkxa FdzTLJ2p4tGIlbncU9IJrRa2oassKOU8AWdBpLReXjOv5IHbpxWniYR1/yo1NpxIFcud FecQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature :dkim-signature; bh=8qf88St9DDFohARjpxMOsSqgMfS644j5Qbz1lUlEwTA=; b=vsrYPGHaqTy+Ir0gxy+cKybuX9s1itOFxIgMgGg/rYwd7PM39FpXysDgeKMuBmLjyt zO4CzkyQ0Dx7+TiS/gPQcY0FEAoLwH2w/p9kK9odoR1MdjTxk00+lFMA5Uyc4I/B2SNa v41lJDkxK+STdfTKlsf6R/w3wXPputZp6vTz0UawzvZft4rTrmoW4QAFOioXvjFhz5l6 spKUKocSv88aD5XKpWBpR5Rn1X5noYBDk9eJNgwUGoQxYR5WWjFZM195JkuQc6rB3MGv vYACka9AvB1G8kZuxMPY0hESz3/cu4vrj3PxZsZSvvLWsYbtXNr8ZrscdF6n1BnHXw6D UpQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=QbYIoA+3; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519 header.b=n0RiflyP; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h2-20020a0564020e8200b0048eafc90734si88240eda.544.2023.01.02.04.44.42; Mon, 02 Jan 2023 04:45:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-ext4-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=@suse.cz header.s=susede2_rsa header.b=QbYIoA+3; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519 header.b=n0RiflyP; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232056AbjABMeQ (ORCPT + 99 others); Mon, 2 Jan 2023 07:34:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48776 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230260AbjABMeO (ORCPT ); Mon, 2 Jan 2023 07:34:14 -0500 Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CEAB73886; Mon, 2 Jan 2023 04:34:13 -0800 (PST) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 8454B340E0; Mon, 2 Jan 2023 12:34:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1672662852; h=from:from:reply-to: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=8qf88St9DDFohARjpxMOsSqgMfS644j5Qbz1lUlEwTA=; b=QbYIoA+3rISlQ6pkWz2FpTQp9Ef2cRZZmIXM1jBabftO0si6M98aY3HBkxSF4aXyQol+W+ vNhpG2ciOS1AV02CVUK73UIZZgQbPPJZxybdLR4k737SbSZjtwmKIzaseCQ/jJjvP1uzVw P2PP7D6ZBaKg9i96FsM2bzNARfn/KaQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1672662852; h=from:from:reply-to: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=8qf88St9DDFohARjpxMOsSqgMfS644j5Qbz1lUlEwTA=; b=n0RiflyPoB6WlCPNWkzfRITt/7wOJIfAsiCZXXXuZDhn9VvtxEv1onmzDI0EqSr22odLRe lkY9CvqZrYbF6mBw== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 639EF139C8; Mon, 2 Jan 2023 12:34:12 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id kmJiGETPsmO6EwAAMHmgww (envelope-from ); Mon, 02 Jan 2023 12:34:12 +0000 Received: by quack3.suse.cz (Postfix, from userid 1000) id E2E12A073E; Mon, 2 Jan 2023 13:34:11 +0100 (CET) Date: Mon, 2 Jan 2023 13:34:11 +0100 From: Jan Kara To: "Fabio M. De Francesco" Cc: Jan Kara , linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, Ira Weiny Subject: Re: [PATCH] fs/ext2: Replace kmap_atomic() with kmap_local_page() Message-ID: <20230102123411.a7xgfocrbr56qruh@quack3> References: <20221231174205.8492-1-fmdefrancesco@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221231174205.8492-1-fmdefrancesco@gmail.com> X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_SOFTFAIL 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-ext4@vger.kernel.org On Sat 31-12-22 18:42:05, Fabio M. De Francesco wrote: > kmap_atomic() is deprecated in favor of kmap_local_page(). Therefore, > replace kmap_atomic() with kmap_local_page(). > > kmap_atomic() is implemented like a kmap_local_page() which also disables > page-faults and preemption (the latter only for !PREEMPT_RT kernels). > > However, the code within the mapping and un-mapping in ext2_make_empty() > does not depend on the above-mentioned side effects. > > Therefore, a mere replacement of the old API with the new one is all it > is required (i.e., there is no need to explicitly add any calls to > pagefault_disable() and/or preempt_disable()). > > Suggested-by: Ira Weiny > Signed-off-by: Fabio M. De Francesco Thanks, the patch looks good and I'll queue it in my tree. I'm not sure why it got missed during the initial conversion by Ira :). Honza > --- > > I tried my best to understand the code within mapping and un-mapping. > However, I'm not an expert. Therefore, although I'm pretty confident, I > cannot be 100% sure that the code between the mapping and the un-mapping > does not depend on pagefault_disable() and/or preempt_disable(). > > Unfortunately, I cannot currently test this changes to check the > above-mentioned assumptions. However, if I'm required to do the tests > with (x)fstests, I have no problems with doing them in the next days. > > If so, I'll test in a QEMU/KVM x86_32 VM, 6GB RAM, booting a kernel with > HIGHMEM64GB enabled. > > I'd like to hear whether or not the maintainers require these tests > and/or other tests. > > fs/ext2/dir.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/fs/ext2/dir.c b/fs/ext2/dir.c > index e5cbc27ba459..0f144c5c7861 100644 > --- a/fs/ext2/dir.c > +++ b/fs/ext2/dir.c > @@ -646,7 +646,7 @@ int ext2_make_empty(struct inode *inode, struct inode *parent) > unlock_page(page); > goto fail; > } > - kaddr = kmap_atomic(page); > + kaddr = kmap_local_page(page); > memset(kaddr, 0, chunk_size); > de = (struct ext2_dir_entry_2 *)kaddr; > de->name_len = 1; > @@ -661,7 +661,7 @@ int ext2_make_empty(struct inode *inode, struct inode *parent) > de->inode = cpu_to_le32(parent->i_ino); > memcpy (de->name, "..\0", 4); > ext2_set_de_type (de, inode); > - kunmap_atomic(kaddr); > + kunmap_local(kaddr); > ext2_commit_chunk(page, 0, chunk_size); > err = ext2_handle_dirsync(inode); > fail: > -- > 2.39.0 > -- Jan Kara SUSE Labs, CR