Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2551271imm; Thu, 9 Aug 2018 15:15:21 -0700 (PDT) X-Google-Smtp-Source: AA+uWPw8W4l2jRt04FEJ0eH/AXLMtEauQBC9rB062tG/cGsfZalivGqSX3gOp9ck7XeGURNUZCJY X-Received: by 2002:a17:902:6909:: with SMTP id j9-v6mr3579672plk.196.1533852921263; Thu, 09 Aug 2018 15:15:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533852921; cv=none; d=google.com; s=arc-20160816; b=pgp5Na9mkVlYv8Y05KEmGyV8u1SYNQ+CkNyQv+FEEVgJh0c2tI/hQAvVJPnJ7luy83 Y7Ac6Yn/dDvu9bUv1/Wk5bWDAIZn7/YeDX4u2/NqUkUQh0eE5yZqKBpIg0lORIqM0XG/ B+x6SqmAMzvkRm91n5j4TkdgxrdN4+Ii3mu5qbAQu99FPcn6RzkfyZ1HzKJcIOouSREc kcmgI4WJKxDTIJXApOTXCj36TTxo5WLp6Pj6D4PunAIIoC7o9gTjJDl2XDG/Cs36b20A Av+DLrXWIW3zuIvQRtd6hBsxoTRrPbyvRn56hKL4iE7MVBcPbnTxWTyNDABC1/JFn/9q a+4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:references :in-reply-to:subject:cc:date:to:from:arc-authentication-results; bh=4H8bkv1uNUSI0EY7z4SV4j8/pgXD2rUcgmDUgFxBTVQ=; b=ij81JQwIsW42Vpcopz4YFsGDEZGIReYQQCDjhBoBQ1m4RQXjqUfUexXUEGsJ4Ox5Cq lNK9ZtltTuc3jtEpcQ3AzRlXJN8IWF9twsR2+vNH9zjEEvKWqRhxSo5IoAI7ulOI8udn bHB65YAIWz1k9WYqaTu3KJ+vE1vGq6AasmBpM441xhRjm58uByJaKbqi/K++AhKdWoNX RL8mBQM5hc+uuMfUQwZZGbpxtBHSkLhCupCL3OWh0S5jNe4L8b/ojurxKpUXXK9ci4rm 4hTAmao45AmQyYN1l+GiAidjHxxaJEttoKo6lKr6DATo0XZGNgZpJY3MihXZs4IVgSPn yLdg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u64-v6si8375566pgu.533.2018.08.09.15.15.06; Thu, 09 Aug 2018 15:15:21 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727438AbeHJAjp (ORCPT + 99 others); Thu, 9 Aug 2018 20:39:45 -0400 Received: from mx2.suse.de ([195.135.220.15]:50502 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726890AbeHJAjp (ORCPT ); Thu, 9 Aug 2018 20:39:45 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id EC05BAE66; Thu, 9 Aug 2018 22:12:51 +0000 (UTC) From: NeilBrown To: "J. Bruce Fields" Date: Fri, 10 Aug 2018 08:12:43 +1000 Cc: Jeff Layton , Alexander Viro , Martin Wilck , linux-fsdevel@vger.kernel.org, Frank Filz , linux-kernel@vger.kernel.org Subject: Re: [PATCH 0/5 - V2] locks: avoid thundering-herd wake-ups In-Reply-To: <20180809173245.GM23873@fieldses.org> References: <153378012255.1220.6754153662007899557.stgit@noble> <20180809173245.GM23873@fieldses.org> Message-ID: <87lg9frxyc.fsf@notabene.neil.brown.name> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --=-=-= Content-Type: text/plain On Thu, Aug 09 2018, J. Bruce Fields wrote: > I think there's also a problem with multiple tasks sharing the same > lock owner. > > So, all locks are exclusive locks for the same range. We have four > tasks. Tasks 1 and 4 share the same owner, the others' owners are > distinct. > > - Task 1 gets a lock. > - Task 2 gets a conflicting lock. > - Task 3 gets another conflicting lock. So now we the tree is > 3->2->1. > - Task 1's lock is released. > - Before task 2 is scheduled, task 4 acquires a new lock. > - Task 2 waits on task 4's lock, we now have > 3->2->4. > > Task 3 shouldn't be waiting--the lock it's requesting has the same owner > as the lock task 4 holds--but we fail to wake up task 3. So task 1 and task 4 are threads in the one process - OK. Tasks 2 and 3 are threads in two other processes. So 2 and 3 conflict with either 1 or 4 equally - why should task 3 be woken? I suspect you got the numbers bit mixed up, but in any case, the "conflict()" function that is passed around takes ownership into account when assessing if one lock conflicts with another. NeilBrown --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEG8Yp69OQ2HB7X0l6Oeye3VZigbkFAltsvFsACgkQOeye3VZi gbnd5g/9HP79msN6KOY9iUVDlp6PPFKF9RC0kvf4INOz05YM/AxZ6EccXZxg/jdq WagfSxoKDD2qPf1WjoxzgMI0WTkbvNi/1YiOEC41HfGWZbMtwRCNjNcg+rw3pmLz sTvyjsstGalxLVu1nEmdYLGt0RieTl6WzcUIEoWH3IxIqSqkyQRxJ/VFwlk+JYVX t9N9uMyrGsEEEvMWEZ+IDK6RGodHwKbmSmpCmVYTPaqGYZ6Dd9pz+ZSSdNgwp9qQ FjlkFBIMvKWzXJDa1mmZpaWZcXylCgBxCAelGsd8AMtxGApABtuJbezwjpL2BbXK x/UrsBeIYU3EuF9TBa52vrq4eTo8OKyXxJl66R2YPsPwmgkDLlfep0ToBZcPbhkl vF1fhB+tfXJ297wblupWOHKDuNDA8Vl++Fmjhql7s174yN4Ak6W8gD6Tmgrsb5Yl 3gnzRh+9+Q7muFIsKD+QEo7dSa9Lk4TV0xYN3COHD3ey2tNXzkhl3a/WSk/CpmMh QnlQqypsKyHA8T4WxqOLE70K+wBsxdp5Ct0gG8Mm12ApO+IETidp48SJNGRicZul 90OcUHXhx8SieIQkJrb1hOwAhp0vmk2oZlZT0eO1f31yJq9OaU+SkR7+qCHgl/Yd Hnfgei/bnHlTdA9/YOqPjjX/2MqV+lfHmu3wWBErz2Ot5mwrkMQ= =Ei+X -----END PGP SIGNATURE----- --=-=-=--