Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp1564477pxb; Fri, 20 Aug 2021 08:27:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx2zwsa0i7pIrWJIrEqvJ+h8aLTJV+ugFT+z2m0uwAEIL5BJnz4MH0kq2GcNHE/yWXPnWap X-Received: by 2002:a05:6638:1504:: with SMTP id b4mr16176164jat.144.1629473226491; Fri, 20 Aug 2021 08:27:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629473226; cv=none; d=google.com; s=arc-20160816; b=eREIMPqoFgd6PBcriFbiexsFZvoqW5t44+RsVZI4aqOid/YAfsTTYUeC/wdhDGy0KR LH8HXpvkei1a5ezXEgZ0+F6b8o9yVZYnKBkrV/YwSfC+i2QX8pBDjJUBr9v83o/LNvml oeitOaH1rQGKfgrRRZVyxb0CmoYowpkhh9a0EvDuqwtE40cV4uNXCTrC7PfrXl4libof BYbPVM8Uc8idlA3m/NHc5Yhtanlp3+pdgFtXLYZv3i0mib1xBcW1oZKdGi5ZNYgPTxBC O5NCCm5SXKtrVmbYQlrs4NFx9REa0xPEPOvROlZeIbzOByFgPOn4eHlUurvs1q1LGaFd 9x1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=AlytKq7WyOzUT/K3H+q4IM3u5JgzyFxG/3NBnWm69Pg=; b=LN6YpGvLuE5coARDat/wvQYAuVerQ45xCZGR5CgZdPHWoHmSs+J6pBvLAaXIf62dSI vUEMh79XlRHbos+gANYo2iqWvF9uDX6YlG0TNzurc0eUAs1DGlTXX8t/6f6qA9nA/Z9Z +qbrvK4iJiJKVkinqNMLfbj3D82SXEQVv9GrR0zI4NSevDX5I+sdZ1QoHgRrKSXOvzGk JNu4ZyEjrOVyji5xkcAfuIOVEAT7lm+oSxUbX2PS5hbWVsxNqaLxC/fLIIeGWbD0Pyu/ Uzz3lL4pMFUuVoP9m1wyqc8Vf42JyVuAw8DQ0zW1UxlpJb9s7RMx5WzcqispPhthg6Ez /XxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Ik49gwU2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w13si6847507ilo.15.2021.08.20.08.26.53; Fri, 20 Aug 2021 08:27:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Ik49gwU2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S241814AbhHTPZX (ORCPT + 99 others); Fri, 20 Aug 2021 11:25:23 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:24814 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241435AbhHTPXq (ORCPT ); Fri, 20 Aug 2021 11:23:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1629472988; 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: in-reply-to:in-reply-to:references:references; bh=AlytKq7WyOzUT/K3H+q4IM3u5JgzyFxG/3NBnWm69Pg=; b=Ik49gwU2rD+dBs/S6VeqrXjfqbxJeAvkyBgUCfvmCVSWjHTkOe/PLJABs2366O6uRdQzxd nyIkW0rFMu//VShpFF2iWUcAeqADuCezoOJMWcCU+0Jc8pNTO0X0xMgwxVV7VaQYgGlDTZ COzTKTvx1xKMSog0hIf3lRTCRi2R6m0= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-492-zEOo5R5kOzWlHT9bseF39g-1; Fri, 20 Aug 2021 11:23:07 -0400 X-MC-Unique: zEOo5R5kOzWlHT9bseF39g-1 Received: by mail-wm1-f69.google.com with SMTP id m13-20020a7bcf2d000000b002e6cd9941a9so4947803wmg.1 for ; Fri, 20 Aug 2021 08:23:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=AlytKq7WyOzUT/K3H+q4IM3u5JgzyFxG/3NBnWm69Pg=; b=e04ecnlTx/VLrrDGf6dK0yIVowpxYCyQsjgd8i14bF40NdNxRnUiQXWaDbu0BWbrFX q7vUuOrFW4+Gessky+l+/LZZCffeAhQW+yBBJkx0tupxuQmQjs1laRoKcKpo/onO6ZtE rxP6rkGbcfYQWbe9AR+rkxV9myCgMt5/Z1fd3Kx5zzPjVjKAGIWT7JBMRqcr/TgXzMoc PEre2lxqixODGITDS2XToO08uicFsAt3gkJdVwK0y5HPBz9Nf9cE4Z0nSddnEDXiH+SI nXgGSb3HVI9yJl3XiDbLDYH8jiyVkMwmQwrEX9Xj8oDYEgMdQXl+cVnctzpwlo3MCAJX Nzug== X-Gm-Message-State: AOAM531aS4bG1p4FQIhcShbl8exQzKA6I/mUUxqj0P2s5Pv0bFf8GLEd sXpiGZtLUvtp7kq3p1Wan3pSrGguoehDNDFzwcKbJWFuTcksp63A6BpU0VWWUd5gWbTxWcCKJsP StDFVYg/6bX1YUJVmJjUzZS1tnQ1R0qnDJGDpTdM7 X-Received: by 2002:a7b:c106:: with SMTP id w6mr4615320wmi.152.1629472985921; Fri, 20 Aug 2021 08:23:05 -0700 (PDT) X-Received: by 2002:a7b:c106:: with SMTP id w6mr4615303wmi.152.1629472985719; Fri, 20 Aug 2021 08:23:05 -0700 (PDT) MIME-Version: 1.0 References: <20210819194102.1491495-1-agruenba@redhat.com> <20210819194102.1491495-11-agruenba@redhat.com> <5e8a20a8d45043e88013c6004636eae5dadc9be3.camel@redhat.com> In-Reply-To: From: Andreas Gruenbacher Date: Fri, 20 Aug 2021 17:22:54 +0200 Message-ID: Subject: Re: [Cluster-devel] [PATCH v6 10/19] gfs2: Introduce flag for glock holder auto-demotion To: Bob Peterson Cc: Steven Whitehouse , Linus Torvalds , Alexander Viro , Christoph Hellwig , "Darrick J. Wong" , Jan Kara , LKML , Matthew Wilcox , cluster-devel , linux-fsdevel , ocfs2-devel@oss.oracle.com Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Aug 20, 2021 at 3:11 PM Bob Peterson wrote: > On 8/20/21 4:35 AM, Steven Whitehouse wrote: > > Hi, > > > > On Thu, 2021-08-19 at 21:40 +0200, Andreas Gruenbacher wrote: > >> From: Bob Peterson > >> > >> This patch introduces a new HIF_MAY_DEMOTE flag and infrastructure > >> that > >> will allow glocks to be demoted automatically on locking conflicts. > >> When a locking request comes in that isn't compatible with the > >> locking > >> state of a holder and that holder has the HIF_MAY_DEMOTE flag set, > >> the > >> holder will be demoted automatically before the incoming locking > >> request > >> is granted. > >> > > I'm not sure I understand what is going on here. When there are locking > > conflicts we generate call backs and those result in glock demotion. > > There is no need for a flag to indicate that I think, since it is the > > default behaviour anyway. Or perhaps the explanation is just a bit > > confusing... > > I agree that the whole concept and explanation are confusing. Andreas > and I went through several heated arguments about the semantics, > comments, patch descriptions, etc. We played around with many different > flag name ideas, etc. We did not agree on the best way to describe the > whole concept. He didn't like my explanation and I didn't like his. So > yes, it is confusing. > > My preferred terminology was "DOD" or "Dequeue On Demand" ... which is useless because it adds no clarity as to whose demand we're talking about. > which makes > the concept more understandable to me. So basically a process can say > "I need to hold this glock, but for an unknown and possibly lengthy > period of time, but please feel free to dequeue it if it's in your way." > And bear in mind that several processes may do the same, simultaneously. > > You can almost think of this as a performance enhancement. This concept > allows a process to hold a glock for much longer periods of time, at a > lower priority, for example, when gfs2_file_read_iter needs to hold the > glock for very long-running iterative reads. Consider a process that allocates a somewhat large buffer and reads into it in chunks that are not page aligned. The buffer initially won't be faulted in, so we fault in the first chunk and write into it. Then, when reading the second chunk, we find that the first page of the second chunk is already present. We fill it, set the HIF_MAY_DEMOTE flag, fault in more pages, and clear the HIF_MAY_DEMOTE flag. If we then still have the glock (which is very likely), we resume the read. Otherwise, we return a short result. Thanks, Andreas