Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp106316ybt; Thu, 25 Jun 2020 16:35:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz5+llEX3LN2ZhU0BTLp4VXsdcUkrLg8mYjMPUqFzqjPTBcs8Ti8nVd+bUKWZOcpn8JZS7X X-Received: by 2002:a17:906:abca:: with SMTP id kq10mr197251ejb.390.1593128110558; Thu, 25 Jun 2020 16:35:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593128110; cv=none; d=google.com; s=arc-20160816; b=p36gFy2ttEzDzndAXDvUntTBKdAKc3Q9WYMUZeLTAmik4QU6WbLvNAnJ1CSOkRIi5D LexoFdP0a5pKtRRDEKs2OGQVPTfFLxeNWPf2a/1gbG6LT2SbXfu8rR41RGTdjgBZODXq 4Waxjdl/8V3OZ7vLWmODXWbwojXuGKdWCzSFdWnVphQRFTv8T+J0NnSWkRdiqq4Cn5ri ViO9JyFSlPlmfUa6fi2lYIKojBUEEJte/N8QnPmu9N0CpnB0KVDcUwkM8VunjlKdsjxr H1BVxYhuuop96Ysug96k0TGpxqJ+E1s4qw/sgigG0q5NyHu5RSfUIFQczn6RknQk4+Sa 3wPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=B2e+9BhdyoZKBQhVVowF1SUb9GpWFGzrObUCYCRlOxI=; b=qZKWNWRW1/6eNrTPLxVwsSi6OSS70WGFFxBqHvOUPkv4o7MCAwaK0yi1MeLRMKrwNY agNW3emgJl85G4smYM/17LkVuOqTxtwx7embmAGuu0bw/9fvsPd8I2B0YGyn6XcNmHwO JDT6dAoMBTC07F5SqP6UHOYqvCyLBtUOMujh279bCtvngd1AsIOPucISBeWW91t94yTR 5pTNQDJ4VLPHQwQ0CVsWtgaHHdePOqRsNhUxaTR3mEsn/JxStPrWZzNgyntHnITdHuAg 0tih/MvqgqCEJt0KiwJoht4hPDw+QGlWNQGXzqHONZqCcsRRPVVOG2a9WwIgDoUX+clu 7QrA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=fqYH5g3m; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y10si11836873edr.504.2020.06.25.16.34.47; Thu, 25 Jun 2020 16:35:10 -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=@google.com header.s=20161025 header.b=fqYH5g3m; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391087AbgFYU0f (ORCPT + 99 others); Thu, 25 Jun 2020 16:26:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45784 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389406AbgFYU0f (ORCPT ); Thu, 25 Jun 2020 16:26:35 -0400 Received: from mail-lf1-x142.google.com (mail-lf1-x142.google.com [IPv6:2a00:1450:4864:20::142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E8634C08C5C1 for ; Thu, 25 Jun 2020 13:26:34 -0700 (PDT) Received: by mail-lf1-x142.google.com with SMTP id k15so3932428lfc.4 for ; Thu, 25 Jun 2020 13:26:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=B2e+9BhdyoZKBQhVVowF1SUb9GpWFGzrObUCYCRlOxI=; b=fqYH5g3mAVkK+2WZwIzFmrKkwPU74dZDdILGRzvB+EKLBaABufN13Q52U1KEYFzKlj sRQmu46b+/4Z7IIYH95+8ndxycal3l2WZaWAzv1qYuNYXsZrdU/Tyky1DvYzVBEKe0wm MvX7Y1VUeWO3u52ih53lEOPHSNh8KLDRr4V1o/Nn+bBdXlFu1J752jg2nNn2zKOknPJx d+4MSZBJabUhn6BgU7g+lIdJutoL8At5Oe/Tyjel9X7rUFLODAnFREzm/rsKPrqsAfel 6DGSdkPRuo9UrS+Z6n8cXsu4m+GeRHSZLmdm+Exh6nSIOIhsGNsRikf1UFXXmum7wZ6v p4XA== 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=B2e+9BhdyoZKBQhVVowF1SUb9GpWFGzrObUCYCRlOxI=; b=PXrLcNNHWZHvu/n5cNqjn6kk+R+6lOWonQflUICK7qUEUz+FIfjqcGHeqws2U5ueaw Xp3GmflDDdhDM7nQfa0XvzMoIVRG9tSu9Sm8/tweUSp4Z5l0wT5UDqde3z1V81jugcMQ bI4fyoWB1O37qwnxkhVru8i96YrozDN7ruZIlhAWElMjEMcAPEwgwodN3lSAuUvb6Ga2 rErpRHOC8DCzsd/iHUsfSIYxvelNJu6eExyZLkacQHGnBY68AJdl8cfz4KXgAMivSoBw nk94GWcS0Qkv2RTCG1fShoQx7JSBipMjHrGEymdcaG7QU5yRg7zbpyZZAA+uGMSxtdqU +rMw== X-Gm-Message-State: AOAM531SFPCC1K+yDHoCAwF8exZ8pJoAbd7Vxj0IuSorxsjCsl3TtpRM LdGk+yQxW3m+kCyk1ckY8bcjtFoRz0GR7mGugox3KA== X-Received: by 2002:ac2:41d9:: with SMTP id d25mr19290098lfi.76.1593116793108; Thu, 25 Jun 2020 13:26:33 -0700 (PDT) MIME-Version: 1.0 References: <20200618222225.102337-1-axelrasmussen@google.com> <20200618222225.102337-2-axelrasmussen@google.com> <20200619083023.GS576905@hirez.programming.kicks-ass.net> In-Reply-To: From: Axel Rasmussen Date: Thu, 25 Jun 2020 13:25:56 -0700 Message-ID: Subject: Re: [RFC PATCH v3 1/1] mmap_lock: add tracepoints around mmap_lock acquisition To: Peter Zijlstra Cc: Michel Lespinasse , David Howells , linux-kernel@vger.kernel.org, linux-mm@kvack.org, Jonathan Adams , David Rientjes , Ying Han Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Peter, one additional question for you. Would you accept this patch if: - The rwsem.{h,c} and lockdep.h changes were reverted - It was split up into 2-3 commits ? Thanks! On Fri, Jun 19, 2020 at 9:28 AM Axel Rasmussen wrote: > > On Fri, Jun 19, 2020 at 1:30 AM Peter Zijlstra wrote: > > > > On Thu, Jun 18, 2020 at 03:22:25PM -0700, Axel Rasmussen wrote: > > > diff --git a/kernel/locking/rwsem.c b/kernel/locking/rwsem.c > > > index f11b9bd3431d..6aabea1cbc5d 100644 > > > --- a/kernel/locking/rwsem.c > > > +++ b/kernel/locking/rwsem.c > > > @@ -1495,6 +1495,20 @@ void __sched down_read(struct rw_semaphore *sem) > > > } > > > EXPORT_SYMBOL(down_read); > > > > > > +/* > > > + * lock for reading > > > + */ > > > +void __sched down_read_contended_hook(struct rw_semaphore *sem, > > > + void (*pre)(void *), > > > + void (*post)(void *), void *arg) > > > +{ > > > + might_sleep(); > > > + rwsem_acquire_read(&sem->dep_map, 0, 0, _RET_IP_); > > > + LOCK_CONTENDED_HOOK(sem, __down_read_trylock, __down_read, pre, post, > > > + arg); > > > +} > > > +EXPORT_SYMBOL(down_read_contended_hook); > > > + > > > int __sched down_read_killable(struct rw_semaphore *sem) > > > { > > > might_sleep(); > > > @@ -1509,6 +1523,24 @@ int __sched down_read_killable(struct rw_semaphore *sem) > > > } > > > EXPORT_SYMBOL(down_read_killable); > > > > > > +int __sched down_read_killable_contended_hook(struct rw_semaphore *sem, > > > + void (*pre)(void *), > > > + void (*post)(void *, int), > > > + void *arg) > > > +{ > > > + might_sleep(); > > > + rwsem_acquire_read(&sem->dep_map, 0, 0, _RET_IP_); > > > + > > > + if (LOCK_CONTENDED_HOOK_RETURN(sem, __down_read_trylock, > > > + __down_read_killable, pre, post, arg)) { > > > + rwsem_release(&sem->dep_map, _RET_IP_); > > > + return -EINTR; > > > + } > > > + > > > + return 0; > > > +} > > > +EXPORT_SYMBOL(down_read_killable_contended_hook); > > > + > > > /* > > > * trylock for reading -- returns 1 if successful, 0 if contention > > > */ > > > @@ -1533,6 +1565,20 @@ void __sched down_write(struct rw_semaphore *sem) > > > } > > > EXPORT_SYMBOL(down_write); > > > > > > +/* > > > + * lock for writing > > > + */ > > > +void __sched down_write_contended_hook(struct rw_semaphore *sem, > > > + void (*pre)(void *), > > > + void (*post)(void *), void *arg) > > > +{ > > > + might_sleep(); > > > + rwsem_acquire(&sem->dep_map, 0, 0, _RET_IP_); > > > + LOCK_CONTENDED_HOOK(sem, __down_write_trylock, __down_write, pre, post, > > > + arg); > > > +} > > > +EXPORT_SYMBOL(down_write_contended_hook); > > > + > > > /* > > > * lock for writing > > > */ > > > @@ -1551,6 +1597,24 @@ int __sched down_write_killable(struct rw_semaphore *sem) > > > } > > > EXPORT_SYMBOL(down_write_killable); > > > > > > +int __sched down_write_killable_contended_hook(struct rw_semaphore *sem, > > > + void (*pre)(void *), > > > + void (*post)(void *, int), > > > + void *arg) > > > +{ > > > + might_sleep(); > > > + rwsem_acquire_read(&sem->dep_map, 0, 0, _RET_IP_); > > > + > > > + if (LOCK_CONTENDED_HOOK_RETURN(sem, __down_write_trylock, > > > + __down_write_killable, pre, post, arg)) { > > > + rwsem_release(&sem->dep_map, _RET_IP_); > > > + return -EINTR; > > > + } > > > + > > > + return 0; > > > +} > > > +EXPORT_SYMBOL(down_write_killable_contended_hook); > > > + > > > /* > > > * trylock for writing -- returns 1 if successful, 0 if contention > > > */ > > > > NAK, absolutely not going to happen. This is an atrocious API to expose, > > worse you're exporting. > > Ack about splitting this up. > > Thanks for taking a look. :)