Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp1296617pxb; Thu, 24 Mar 2022 17:09:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz5C4A9oKll0TJkAbKM+XQleqO+3WcfRH1KspjxClEZ+BEuawvKI8gfP0gmQjpl0uVsLUA2 X-Received: by 2002:a63:250:0:b0:386:4fd7:432b with SMTP id 77-20020a630250000000b003864fd7432bmr3205613pgc.26.1648166953153; Thu, 24 Mar 2022 17:09:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648166953; cv=none; d=google.com; s=arc-20160816; b=hEuzHYQ3pOTqRx2AI4Z1guc1TgOmftD6BwIJZFO4K7GQMcmf2OwCGz6aL648bnA99y OAnTd1amjIk3R55oDrocGDRXVhBE+AevXzgQO/w1ecYTn7KjHsGMvzuBPUZtqDFjsgsh qsHJj8+yLv2HR7tFFp+i6in5/UmJwMbKR22Tjpeuw/rQJT2uDhFfhVJ2LOrBDQs2pRKo vbpUibEskCcZiMu/rCto3LD9mzqQo54tCWfHq8E1Zlo0ee7bsz0PPbwczzeBn2rD1khz 8dTOz1vsalkrsYEaFGsEr2/nmRQ8PYsgXxFmdGSVrEWmOx6UbDDulLXZJ26qjlXHAnyO AbnQ== 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; bh=3hZVbpHDywGkXTePwfYB+/7l7SaLUJq+aT60p7gyAiI=; b=DKCmSoMeEHEXQR7QOVX89gU6uK9xSlU+cM5bQa+gUiZdTIeyTg53euitUSUNE8jksU jb6YnX4Wyj5YdEa+HyjHnK/6JyVsa7LHZ8B+r+c2PwNbweiG/4La180Hy5faomOIvojH nei++1YbtMPNO3AVz4K3tQg7YyEPtzgv7G8lFUD/o1Av5DatR3arlL6d5t4/TF8Vp8lL xMPdV4/JMUqx1pjbRWKl5PBDlhggRww31ObztEyz3y4bNUTOhd2U9djdy7tFlZgfx8az Ctjn5E72wmUn8x1kB518w5bxWrio+QgsCM/DUP8caLMinLIJc2S/0SBS3yeCBPyRJttO YRtQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=GvcXdybU; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w30-20020a63161e000000b003816043ef14si740962pgl.265.2022.03.24.17.08.59; Thu, 24 Mar 2022 17:09:13 -0700 (PDT) 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=@kernel.org header.s=k20201202 header.b=GvcXdybU; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239076AbiCWQ2U (ORCPT + 99 others); Wed, 23 Mar 2022 12:28:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40640 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238564AbiCWQ2S (ORCPT ); Wed, 23 Mar 2022 12:28:18 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AF2D0E093 for ; Wed, 23 Mar 2022 09:26:47 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4AE4D617ED for ; Wed, 23 Mar 2022 16:26:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 85B50C340E8; Wed, 23 Mar 2022 16:26:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1648052806; bh=CuBjkLYRVIIbPFpIa1Vl/F+x4Z7zFyfHbwVgo+ZjRio=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=GvcXdybUQM9gcIggCekgj5mnNxjvBi72554H//JkbF6fQPFJIgDbDbZPvBnj5z19u fZXv1v3djBOYB+hysQsnADJtiCrUJjbv+4BlgCBsVrYcqXlWw/qBxW72kH0j6/EiPM JXngEyhQWZqh/wcv1dDYhyu4eeyxG1kTLp0+FQUFSBd4aMKMWILjRBrhgwFb+XWuWE BGql5CU7E8s4+tEx3RI300EvwKcbNRDxov5lbxMuDpAn8I3a2AQop4jxZk86Dx6AE0 I14kSjNfnYcmVaHbh7PCNpgNBoXB/WeeVMbLIcBEWL7AMeOCCPWSZNESvo/gW0Mztt eAR6Jo9nyHNAQ== Date: Wed, 23 Mar 2022 09:26:44 -0700 From: Jaegeuk Kim To: Linus Torvalds Cc: Tim Murray , Waiman Long , Linux Kernel Mailing List , Linux F2FS Dev Mailing List Subject: Re: [GIT PULL] f2fs for 5.18 Message-ID: References: <51cded74-3135-eed8-06d3-0b2165e3b379@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-8.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 03/22, Linus Torvalds wrote: > On Tue, Mar 22, 2022 at 5:34 PM Tim Murray wrote: > > > > AFAICT, what's happening is that rwsem_down_read_slowpath > > modifies sem->count to indicate that there's a pending reader while > > f2fs_ckpt holds the write lock, and when f2fs_ckpt releases the write > > lock, it wakes pending readers and hands the lock over to readers. > > This means that any subsequent attempt to grab the write lock from > > f2fs_ckpt will stall until the newly-awakened reader releases the read > > lock, which depends on the readers' arbitrarily long scheduling > > delays. > > Ugh. > > So I'm looking at some of this, and you have things like this: > > f2fs_down_read(&F2FS_I(inode)->i_sem); > cp_reason = need_do_checkpoint(inode); > f2fs_up_read(&F2FS_I(inode)->i_sem); > > which really doesn't seem to want a sleeping lock at all. > > In fact, it's not clear that it has any business serializing with IO > at all. It seems to just check very basic inode state. Very strange. > It's the kind of thing that the VFS layer tends to use te i_lock > *spinlock* for. Um.. let me check this i_sem, introduced by d928bfbfe77a ("f2fs: introduce fi->i_sem to protect fi's info"). OTOH, I was suspecting the major contetion would be f2fs_lock_op -> f2fs_down_read(&sbi->cp_rwsem); , which was used for most of filesystem operations. And, when we need to do checkpoint, we'd like to block internal operations by f2fs_lock_all -> f2fs_down_write(&sbi->cp_rwsem); So, what I expected was giving the highest priority to the checkpoint thread by grabbing down_write to block all the other readers. > > And perhaps equally oddly, then when you do f2fs_issue_checkpoint(), > _that_ code uses fancy lockless lists. > > I'm probably mis-reading it. > > Linus