Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp1944978imm; Thu, 14 Jun 2018 06:26:42 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIiEPzmaYRJl9s8eB41IZtkBflPT/NfuAFtf1HTFqLcv+AJFEs0+MWgB5jRqXKFriXGpVw2 X-Received: by 2002:a17:902:bb90:: with SMTP id m16-v6mr3089611pls.50.1528982802532; Thu, 14 Jun 2018 06:26:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528982802; cv=none; d=google.com; s=arc-20160816; b=YOZAMdJXvNpqYgxr9eAvANuRzixQjOKzt/yWYktwxSYbhC1jvLX5I9LQtX5uyhq+j7 8kzGLpsxCyBxLLcW6V1spft0KIqeclUD7ecnI44SoMlL2W+vhiB4naOoYUXIXIfj4eDJ fyOAzQNGT0QhDwCB3GCUXvOhGIZAKFtpYmNQemjSrsSITM7/C5lBwHrO5Ygu41Y3antD h4mjKbPCzl18/lad9s8ABUEzPQAb6Hcf5/rEfGRlVbeLuAk3eGOAsALyfa/T8GDSrsX9 4FeC2IBb4o7RROm37KhFzZKMbZ5vb+3g/HP84iEPiN/f8TSUgjxbm6FjzLMt4K99LkGW poEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=MQrFi08I8Uu0pX76cnCgRqhm9S27HfhvZOPX8JDflMg=; b=qK/iM8Ne+XlIV0/wF93PjcbiPQc/c9ZhDdPWhdjrtDRIspxpRk1r+g4mWxjJTPJnFz wzFGnnOgQMrJJirZFHaYpgD6UHUbpO2qjDozTsXhsTMTKowPvlC1PXX1dp921Xw51M/b ha1j+mUpypJOlPfNPRXc/C8WG0QzGHqvI6IvHmDH6OEHdCfTj5l1f/6zARfX55U3X1wo 7DKQs+jJVbtsBV1IKrvJOaR7U81Nh9kBWDEgeJ8/fa4ZIw1UuwhHj+tsgT9yKGAgbGnT wSPXTyFvvpAl8WWGB4qc5QmU11qoG6ZhRShGg5ea7FwPs3hUNwtGrgH/B/7UmVQCH+FB +Lmg== 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 p16-v6si5045096pff.356.2018.06.14.06.26.27; Thu, 14 Jun 2018 06:26:42 -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 S1755213AbeFNN0B (ORCPT + 99 others); Thu, 14 Jun 2018 09:26:01 -0400 Received: from atrey.karlin.mff.cuni.cz ([195.113.26.193]:33469 "EHLO atrey.karlin.mff.cuni.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754967AbeFNN0A (ORCPT ); Thu, 14 Jun 2018 09:26:00 -0400 Received: by atrey.karlin.mff.cuni.cz (Postfix, from userid 512) id 942C2803F4; Thu, 14 Jun 2018 15:25:58 +0200 (CEST) Date: Thu, 14 Jun 2018 15:25:58 +0200 From: Pavel Machek To: Mathieu Desnoyers Cc: Florian Weimer , carlos , Peter Zijlstra , "Paul E. McKenney" , Boqun Feng , Thomas Gleixner , linux-kernel , libc-alpha Subject: Re: Restartable Sequences system call merged into Linux Message-ID: <20180614132557.GA15201@amd> References: <1084280721.10859.1528746558696.JavaMail.zimbra@efficios.com> <31fc101a-295b-067b-1a82-7e9e509fc92f@redhat.com> <305409897.10888.1528747473727.JavaMail.zimbra@efficios.com> <091061df-3482-8762-30e4-feaf3417be11@redhat.com> <417742741.11550.1528821084084.JavaMail.zimbra@efficios.com> <20180614122759.GB8798@amd> <894222691.12973.1528981314012.JavaMail.zimbra@efficios.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="4Ckj6UjgE2iN1+kY" Content-Disposition: inline In-Reply-To: <894222691.12973.1528981314012.JavaMail.zimbra@efficios.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --4Ckj6UjgE2iN1+kY Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi! > >> >>>> It should be noted that there can be only one rseq TLS area regis= tered per > >> >>>> thread, > >> >>>> which can then be used by many libraries and by the executable, s= o this is a > >> >>>> process-wide (per-thread) resource that we need to manage careful= ly. > >> >>> > >> >>> Is it possible to resize the area after thread creation, perhaps e= ven > >> >>> from other threads? > >> >>=20 > >> >> I'm not sure why we would want to resize it. The per-thread area is= fixed-size. > >> >> Its layout is here: include/uapi/linux/rseq.h: struct rseq > >> >=20 > >> > Looks I was mistaken and this is very similar to the robust mutex li= st. > >> >=20 > >> > Should we treat it the same way? Always allocate it for each new th= read > >> > and register it with the kernel? > >>=20 > >> That would be an efficient way to do it, indeed. There is very little > >> performance overhead to have rseq registered for all threads, whether = or > >> not they intend to run rseq critical sections. > >=20 > > People with slow / low memory machines would prefer not to see > > overhead they don't need... >=20 > In terms of memory usage, if people don't want the extra few bytes of mem= ory > used by rseq in the kernel, they should use CONFIG_RSEQ=3Dn. >=20 > In terms of overhead, let's have a closer look at what it means: when a t= hread > is registered to rseq, but does not enter rseq critical sections, only th= is > extra work is done by the kernel: >=20 > - rseq_preempt(): on preemption, the scheduler sets the TIF_NOTIFY_RESUME= thread > flag, so rseq_handle_notify_resume() can check whether it's in a rseq c= ritical > section when returning to user-space, > - rseq_signal_deliver(): on signal delivery, rseq_handle_notify_resume() = checks > whether it's in a rseq critical section, > - rseq_migrate: on migration, the scheduler sets TIF_NOTIFY_RESUME as wel= l, Yes, this is not likely to be noticeable. But the proposal wanted to add a syscall to thread creation, right? And I believe that may be noticeable. Pavel --=20 (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blo= g.html --4Ckj6UjgE2iN1+kY Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAlsibOUACgkQMOfwapXb+vLeIwCfVa9XGEB+bqxtfQ8k3dEBf7ay e0sAn31Fa1rgVE0iix2TYFQzolrRzHKP =tD/h -----END PGP SIGNATURE----- --4Ckj6UjgE2iN1+kY--