Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp3285392pxp; Tue, 22 Mar 2022 16:29:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzf11bdWU59OXXjnKWruXIxTcnFJ7lCZFzmCTcS90RJ/P+dQd+Z77mCNo3VW1cn9Jm9pjTC X-Received: by 2002:a17:90a:1b6e:b0:1c6:168e:11e7 with SMTP id q101-20020a17090a1b6e00b001c6168e11e7mr7837362pjq.136.1647991746765; Tue, 22 Mar 2022 16:29:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647991746; cv=none; d=google.com; s=arc-20160816; b=nex+2VBvKT2clvfspJQXuXpZ34YJnsY7J9/Lo+ZhCGiWo+V+yT+Mz3WjA8uK+taDpL wMtK1UwV8ZlVD2B86CQt1whiZ3jAxFgO4JoTscODtlbpTyTW2k2jE0SIMiBbbS6cUlJ/ ccxyvM5DOfHAMc3NXrRFI6XKSmETAZC4e2PUs8ubWDGCC+Rt7TDPVL2aEn0T8ZsUhvT5 v7Q9fII9Xp5Ezd4R1767Xp51ucwrYmyF6H8Oc4DQvK+TRcy05b7EcceffsMBLs90u91j xeK4B4axRpevzTin71jVEsMIBv1fzKFN9+44u8l3/ZPj/vdzDo8qjOxB+wpiv7EQF0iI sBNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=7XRQWPJTa2nAm0XTHwZnMEHTKHif4VV7vwzt+VcrTSk=; b=A7E3dZ0JDK+/eDVAawLvUHYJ2fT3OvW/6iqxHOC77AQfIfDnORPv6KBaJ7TcfF/fmg AW5F4vm5lxBjGnux2ZnEdlWscBoH5xds5VTaCB+EPa/eEghcd6O9RxS0URApw/DTjk8Q YX9PsRfHfcNY8tgxhxgmbUhdSalHSuI//oQAFbhd6X7w3DroJu2XSzWGm23B7jS44lKN IKpxwCOaD+/F1VBvHUte6ou5KO7uROTYJb4Tb71C9Mg9bqRMNYoNthUBd+bv5k/Q2scP QCV4BEgi27dj+C92QdXfVfUp/bL2w7Fel42T+eBywr+RPkKHj4E6o2d6552blFMSMvUk yYoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=WJ2zbHwP; 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 b15-20020a6567cf000000b003816043ee12si12367744pgs.7.2022.03.22.16.28.50; Tue, 22 Mar 2022 16:29:06 -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=@redhat.com header.s=mimecast20190719 header.b=WJ2zbHwP; 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 S237934AbiCVRi6 (ORCPT + 99 others); Tue, 22 Mar 2022 13:38:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40354 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236492AbiCVRiz (ORCPT ); Tue, 22 Mar 2022 13:38:55 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 5C860506FD for ; Tue, 22 Mar 2022 10:37:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1647970646; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7XRQWPJTa2nAm0XTHwZnMEHTKHif4VV7vwzt+VcrTSk=; b=WJ2zbHwP64smN5daibrjbs1YF9MdCUKYZXuXI1lyox5N0zfdHLoFQ3+O6GvKqeC3hA4hqe OQ4cU9oFpjYkJJQeOhl/IOdE9WEMtaDinnYMeWYD1aiPdBzGGVfj8lhvAqywiJmRpXnglp i4z8oDQShkA1KxhY+TOliTGYkvVLc38= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-413-A0e0tYQ7NpOv-u0M9dblTQ-1; Tue, 22 Mar 2022 13:37:24 -0400 X-MC-Unique: A0e0tYQ7NpOv-u0M9dblTQ-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8BA521029A87; Tue, 22 Mar 2022 17:37:24 +0000 (UTC) Received: from [10.18.17.215] (dhcp-17-215.bos.redhat.com [10.18.17.215]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3EE5D4029C6; Tue, 22 Mar 2022 17:37:24 +0000 (UTC) Message-ID: <51cded74-3135-eed8-06d3-0b2165e3b379@redhat.com> Date: Tue, 22 Mar 2022 13:37:24 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: [GIT PULL] f2fs for 5.18 Content-Language: en-US To: Linus Torvalds , Jaegeuk Kim Cc: Linux Kernel Mailing List , Linux F2FS Dev Mailing List References: From: Waiman Long In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.85 on 10.11.54.9 X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, SPF_NONE,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 3/22/22 13:22, Linus Torvalds wrote: > On Mon, Mar 21, 2022 at 1:39 PM Jaegeuk Kim wrote: >> In this cycle, f2fs has some performance improvements for Android workloads such >> as using read-unfair rwsems [...] > I've pulled this, but that read-unfair rwsem code looks incredibly > dodgy. Doing your own locking is always a bad sign, and it ahs > traditionally come back to bite us pretty much every time. At least it > uses real lock primitives, just in a really odd way. > > The whole notion of making an rwsem unfair to readers sounds really > really odd. I mean, the whole and only _point_ of an rwsem is to > allow concurrent readers, and traditionally if it's unfair it's unfair > to _writers_ because that tends to be better for throughput (but > unfairness can cause horrible latency). > > So it smells like there's something bad going on in f2fs. > > That said, I'm adding Waiman to the cc here in case he would have > ideas at least for a cleaner interface. Our rw_semaphores are > explicitly trying to be fair, because unfairness (the other way) was > such a big problem. > > I'm wondering it the optimistic read lock stealing is bothering f2fs? I don't believe it is the optimistic read lock stealing code that is bothering f2fs. AFAICS, the read-unfair rwsem code is created to resolve a potential lock starvation problem that they found on linux-5.10.y stable tree. I believe I have fixed that in the v5.11 kernel, see commit 2f06f702925 ("locking/rwsem: Prevent potential lock starvation"). However that commit is not in the stable tree. In fact, I have moved forward and taken out reader optimistic spinning but added just optimistic lock stealing instead. I believe the problem would have solved by including that patch series in their build. I haven't gotten any response as to whether they had tested this or not. Apparently they prefer to upstream this stop-gap solution. Cheers, Longman