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=-0.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED 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 C7C7CC43331 for ; Thu, 2 Apr 2020 19:06:04 +0000 (UTC) Received: from mother.openwall.net (mother.openwall.net [195.42.179.200]) by mail.kernel.org (Postfix) with SMTP id 21DEE20719 for ; Thu, 2 Apr 2020 19:06:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="hvEITigZ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 21DEE20719 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kernel-hardening-return-18396-kernel-hardening=archiver.kernel.org@lists.openwall.com Received: (qmail 3499 invoked by uid 550); 2 Apr 2020 19:05:58 -0000 Mailing-List: contact kernel-hardening-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Received: (qmail 3479 invoked from network); 2 Apr 2020 19:05:57 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=RlBOg0dum66ebZmfIZrWlU1IBkKC8efn4oYc6hOU1L0=; b=hvEITigZV32UOF8ubiUjd+p22kCZAiMJFfBqDEEHBqM8+KyLyY3+cjtQPsswx+RUpm HJ1KgeDiJRSfzbkwXPk1cZ6pfQGvYJULSwuj6II4fCP3quqyDwcIFxIxB2CVRWFVsr87 Cmk6cMB40cebsPRptNEHYRfJuiAA45R2UT23k= 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=RlBOg0dum66ebZmfIZrWlU1IBkKC8efn4oYc6hOU1L0=; b=npPOe8JtlWsYVM56SbZe1OajDA7qmI68ItMeCakHNdDOAfKA5KNh7xLXYjlFGiVRYf LO3LKbMe5oNyKY2YOHYauCbqosOrkxoX7qxtTOTSDTqWo0QUA881Fo4urCVeVSsqgbaq fWgoqJMCY4xx++1nrwcNn8gQl5nEtqSCslJcRTBDF15tD5c/1WKKCD3LspOFkU0Ag/In ORWMQe3KUZKXL87tiYjHKyMbVWk2lKZOGqhk+7ad3A8QLfTkog3XyssUYPVyQ4G20hLt zTeXe8jxruPdghrzJQ/ohXSl/mczXrjPhRhh2BQBNwB1cs3aMMZ2pRANvfLIX6orRgKm F1qQ== X-Gm-Message-State: AGi0PuYDn9FmBFHpQHpDPJ4IRWleBdpS4305nX1XFEPKHa/a2N/Pdot+ heDObLOx/WhnKWJdSOyw8qtK6vo89Hw= X-Google-Smtp-Source: APiQypJMrExtBvPPyamiukkhFnrtARNtGE9sboICmKnLC0vTMJowKO/XcMIuRijDJkea1lda2mHX7g== X-Received: by 2002:a2e:b5d1:: with SMTP id g17mr2666366ljn.139.1585850804156; Thu, 02 Apr 2020 11:06:44 -0700 (PDT) X-Received: by 2002:a2e:8652:: with SMTP id i18mr2793744ljj.265.1585850802219; Thu, 02 Apr 2020 11:06:42 -0700 (PDT) MIME-Version: 1.0 References: <20200324215049.GA3710@pi3.com.pl> <202003291528.730A329@keescook> <87zhbvlyq7.fsf_-_@x220.int.ebiederm.org> <877dyym3r0.fsf@x220.int.ebiederm.org> In-Reply-To: <877dyym3r0.fsf@x220.int.ebiederm.org> From: Linus Torvalds Date: Thu, 2 Apr 2020 11:06:02 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] signal: Extend exec_id to 64bits To: "Eric W. Biederman" Cc: Jann Horn , Alan Stern , Andrea Parri , Will Deacon , Peter Zijlstra , Boqun Feng , Nicholas Piggin , David Howells , Jade Alglave , Luc Maranget , "Paul E. McKenney" , Akira Yokosawa , Daniel Lustig , Adam Zabrocki , kernel list , Kernel Hardening , Oleg Nesterov , Andy Lutomirski , Bernd Edlinger , Kees Cook , Andrew Morton , stable , Marco Elver , Dmitry Vyukov , kasan-dev Content-Type: text/plain; charset="UTF-8" On Thu, Apr 2, 2020 at 6:14 AM Eric W. Biederman wrote: > > Linus Torvalds writes: > > > tasklist_lock is aboue the hottest lock there is in all of the kernel. > > Do you know code paths you see tasklist_lock being hot? It's generally not bad enough to show up on single-socket machines. But the problem with tasklist_lock is that it's one of our remaining completely global locks. So it scales like sh*t in some circumstances. On single-socket machines, most of the truly nasty hot paths aren't a huge problem, because they tend to be mostly readers. So you get the cacheline bounce, but you don't (usually) get much busy looping. The cacheline bounce is "almost free" on a single socket. But because it's one of those completely global locks, on big multi-socket machines people have reported it as a problem forever. Even just readers can cause problems (because of the cacheline bouncing even when you just do the reader increment), but you also end up having more issues with writers scaling badly. Don't get me wrong - you can get bad scaling on other locks too, even when they aren't really global - we had that with just the reference counter increment for the user signal accounting, after all. Neither of the reference counts were actually global, but they were just effectively single counters under that particular load (ie the count was per-user, but the load ran as a single user). The reason tasklist_lock probably doesn't come up very much is that it's _always_ been expensive. It has also caused some fundamental issues (I think it's the main reason we have that rule that reader-writer locks are unfair to readers, because we have readers from interrupt context too, but can't afford to make normal readers disable interrupts). A lot of the tasklist lock readers end up looping quite a bit inside the lock (looping over threads etc), which is why it can then be a big deal when the rare reader shows up. We've improved a _lot_ of those loops. That has definitely helped for the common cases. But we've never been able to really fix the lock itself. Linus