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 X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id ED484C56201 for ; Tue, 24 Nov 2020 09:12:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 826632075A for ; Tue, 24 Nov 2020 09:12:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731003AbgKXJMS (ORCPT ); Tue, 24 Nov 2020 04:12:18 -0500 Received: from eu-smtp-delivery-151.mimecast.com ([207.82.80.151]:53139 "EHLO eu-smtp-delivery-151.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728826AbgKXJMR (ORCPT ); Tue, 24 Nov 2020 04:12:17 -0500 Received: from AcuMS.aculab.com (156.67.243.126 [156.67.243.126]) (Using TLS) by relay.mimecast.com with ESMTP id uk-mta-62--NW9eR5TMCq62nAf3IBhNg-1; Tue, 24 Nov 2020 09:12:12 +0000 X-MC-Unique: -NW9eR5TMCq62nAf3IBhNg-1 Received: from AcuMS.Aculab.com (fd9f:af1c:a25b:0:43c:695e:880f:8750) by AcuMS.aculab.com (fd9f:af1c:a25b:0:43c:695e:880f:8750) with Microsoft SMTP Server (TLS) id 15.0.1347.2; Tue, 24 Nov 2020 09:12:12 +0000 Received: from AcuMS.Aculab.com ([fe80::43c:695e:880f:8750]) by AcuMS.aculab.com ([fe80::43c:695e:880f:8750%12]) with mapi id 15.00.1347.000; Tue, 24 Nov 2020 09:12:12 +0000 From: David Laight To: 'Chao Yu' , 'Sahitya Tummala' , Jaegeuk Kim , "linux-f2fs-devel@lists.sourceforge.net" CC: "linux-kernel@vger.kernel.org" Subject: RE: [PATCH] f2fs: change to use rwsem for cp_mutex Thread-Topic: [PATCH] f2fs: change to use rwsem for cp_mutex Thread-Index: AQHWwVm8Sokw4eOdHU6M1bsTH5HkTqnV8p0QgACp5gCAAGGJ4A== Date: Tue, 24 Nov 2020 09:12:12 +0000 Message-ID: References: <1606109312-1944-1-git-send-email-stummala@codeaurora.org> <7f5213fb9b334d1290f019ab8ed6ee71@AcuMS.aculab.com> In-Reply-To: Accept-Language: en-GB, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.202.205.107] MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=C51A453 smtp.mailfrom=david.laight@aculab.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: aculab.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: base64 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org RnJvbTogQ2hhbyBZdQ0KPiBTZW50OiAyNCBOb3ZlbWJlciAyMDIwIDAzOjEyDQo+IA0KPiBPbiAy MDIwLzExLzI0IDE6MDUsIERhdmlkIExhaWdodCB3cm90ZToNCj4gPiBGcm9tOiBTYWhpdHlhIFR1 bW1hbGENCj4gPj4gU2VudDogMjMgTm92ZW1iZXIgMjAyMCAwNToyOQ0KPiA+Pg0KPiA+PiBVc2Ug cndzZW0gdG8gZW5zdXJlIHNlcmlhbGl6YXRpb24gb2YgdGhlIGNhbGxlcnMgYW5kIHRvIGF2b2lk DQo+ID4+IHN0YXJ2YXRpb24gb2YgaGlnaCBwcmlvcml0eSB0YXNrcywgd2hlbiB0aGUgc3lzdGVt IGlzIHVuZGVyDQo+ID4+IGhlYXZ5IElPIHdvcmtsb2FkLg0KPiA+DQo+ID4gSSBjYW4ndCBzZWUg YW55IHJlY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lIG11dGV4IGlz IHJlbGVhc2VkLCBhbmQgdGhleSBhcmUgd29rZW4gaW4gdGhlIG9yZGVyDQp0aGV5IHdlbnQgdG8g c2xlZXAuDQoNCldoaWxlIHRoaXMgYmVoYXZpb3VyIG1pZ2h0IG5vdCBiZSB0aGUgb25lIHlvdSB3 YW50LCByZWx5aW5nIG9uDQpyd3NlbSAod2hpY2ggbWlnaHQgaGFwcGVuIGN1cnJlbnRseSB0byB3 b3JrIGRpZmZlcmVudGx5KSBkb2Vzbid0DQpzZWVtIHRoZSBjb3JyZWN0IGxvbmcgdGVybSBmaXgu DQoNCglEYXZpZA0KDQotDQpSZWdpc3RlcmVkIEFkZHJlc3MgTGFrZXNpZGUsIEJyYW1sZXkgUm9h ZCwgTW91bnQgRmFybSwgTWlsdG9uIEtleW5lcywgTUsxIDFQVCwgVUsNClJlZ2lzdHJhdGlvbiBO bzogMTM5NzM4NiAoV2FsZXMpDQo= 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 X-Spam-Level: X-Spam-Status: No, score=-3.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A9CA8C2D0E4 for ; Tue, 24 Nov 2020 09:12:36 +0000 (UTC) Received: from lists.sourceforge.net (lists.sourceforge.net [216.105.38.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id ECC342075A; Tue, 24 Nov 2020 09:12:35 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=sourceforge.net header.i=@sourceforge.net header.b="UHLdwtZe"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=sf.net header.i=@sf.net header.b="hg4hZ+Ag" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org ECC342075A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=ACULAB.COM Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linux-f2fs-devel-bounces@lists.sourceforge.net Received: from [127.0.0.1] (helo=sfs-ml-2.v29.lw.sourceforge.com) by sfs-ml-2.v29.lw.sourceforge.com with esmtp (Exim 4.90_1) (envelope-from ) id 1khUNG-00063v-HC; Tue, 24 Nov 2020 09:12:34 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-2.v29.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1khUNF-00063o-FG for linux-f2fs-devel@lists.sourceforge.net; Tue, 24 Nov 2020 09:12:33 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:Content-Type:MIME-Version :In-Reply-To:References:Message-ID:Date:Subject:CC:To:From:Sender:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=hxhsx7U6lHbJ5mC9Wsxd4zJH84fER7aqRnXZGRAP7To=; b=UHLdwtZeyZtmxt0myAwIY6r74a LVeRWvk9fPIYD6e14YZjDnEn14L2UDdgPlqKPd4w2hj0KE9l1DH8JHg5H/grZLD0LzqJUAxoeRsDu BeSbcFzIkDzPC8xJ2Zu74jfysAdUqnm+HLOuCnYyCtCJghDEebX1A8OtXErsnTfPEsLs=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:Content-Type:MIME-Version:In-Reply-To: References:Message-ID:Date:Subject:CC:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=hxhsx7U6lHbJ5mC9Wsxd4zJH84fER7aqRnXZGRAP7To=; b=hg4hZ+AgmB5K336ngW6pJM4YXh cbvRlwD9S3Y1h9jO5CBkuWDHDxdD0kFZNftXRxAlqdJrBdrNUyP8c9aY+rW343gcx+Zs6AgW9BisD qrOwA4V3Fa3a4QbKSQB9G7nKv7I0tt9dKa8hoqlFFU2OdbQC3+Lm77bjszmL3szQpbgM=; Received: from eu-smtp-delivery-151.mimecast.com ([207.82.80.151]) by sfi-mx-3.v28.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-SHA384:256) (Exim 4.92.2) id 1khUNC-001yGM-9f for linux-f2fs-devel@lists.sourceforge.net; Tue, 24 Nov 2020 09:12:33 +0000 Received: from AcuMS.aculab.com (156.67.243.126 [156.67.243.126]) (Using TLS) by relay.mimecast.com with ESMTP id uk-mta-62--NW9eR5TMCq62nAf3IBhNg-1; Tue, 24 Nov 2020 09:12:12 +0000 X-MC-Unique: -NW9eR5TMCq62nAf3IBhNg-1 Received: from AcuMS.Aculab.com (fd9f:af1c:a25b:0:43c:695e:880f:8750) by AcuMS.aculab.com (fd9f:af1c:a25b:0:43c:695e:880f:8750) with Microsoft SMTP Server (TLS) id 15.0.1347.2; Tue, 24 Nov 2020 09:12:12 +0000 Received: from AcuMS.Aculab.com ([fe80::43c:695e:880f:8750]) by AcuMS.aculab.com ([fe80::43c:695e:880f:8750%12]) with mapi id 15.00.1347.000; Tue, 24 Nov 2020 09:12:12 +0000 From: David Laight To: 'Chao Yu' , 'Sahitya Tummala' , Jaegeuk Kim , "linux-f2fs-devel@lists.sourceforge.net" Thread-Topic: [PATCH] f2fs: change to use rwsem for cp_mutex Thread-Index: AQHWwVm8Sokw4eOdHU6M1bsTH5HkTqnV8p0QgACp5gCAAGGJ4A== Date: Tue, 24 Nov 2020 09:12:12 +0000 Message-ID: References: <1606109312-1944-1-git-send-email-stummala@codeaurora.org> <7f5213fb9b334d1290f019ab8ed6ee71@AcuMS.aculab.com> In-Reply-To: Accept-Language: en-GB, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.202.205.107] MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=C51A453 smtp.mailfrom=david.laight@aculab.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: aculab.com Content-Language: en-US X-Headers-End: 1khUNC-001yGM-9f Subject: Re: [f2fs-dev] [PATCH] f2fs: change to use rwsem for cp_mutex X-BeenThere: linux-f2fs-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net From: Chao Yu > Sent: 24 November 2020 03:12 > > On 2020/11/24 1:05, David Laight wrote: > > From: Sahitya Tummala > >> Sent: 23 November 2020 05:29 > >> > >> Use rwsem to ensure serialization of the callers and to avoid > >> starvation of high priority tasks, when the system is under > >> heavy IO workload. > > > > I can't see any read lock requests. > > > > So why the change? > > Hi David, > > You can check the context of this patch in below link: > > https://lore.kernel.org/linux-f2fs-devel/8e094021b958f9fe01df1183a2677882@codeaurora.org/T/#t > > BTW, the root cause here is that mutex lock won't serialize callers, so there > could be potential starvation problem when this lock is always grabbed by high > priority tasks. That doesn't seem right. If I read the above correctly it was high priority tasks that were being 'starved' precisely because mutex lock serializes wakers. If you have a lock that is contended so much that it is held 100% of the time you need a different locking strategy. IIRC mutex locks are 'ticket' locks so that only one thread is woken each time the mutex is released, and they are woken in the order they went to sleep. While this behaviour might not be the one you want, relying on rwsem (which might happen currently to work differently) doesn't seem the correct long term fix. David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales) _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel