Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp6654221ybv; Wed, 12 Feb 2020 16:55:16 -0800 (PST) X-Google-Smtp-Source: APXvYqxgR324vLOUbeiLTbwJfXj/71OVrtzK+sLthb1aM7+Y71RJwNrlQcDhERj7KpPn0B6jnr3v X-Received: by 2002:aca:c383:: with SMTP id t125mr1203981oif.122.1581555316277; Wed, 12 Feb 2020 16:55:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581555316; cv=none; d=google.com; s=arc-20160816; b=g9bhVR3XV9q8COnV3YjLKIoIcqBHxNYCtI5WxDM9oeNv7K/clRoCH0Iuv2A43lyH5j catwHDwTS7BegvvO0gMrp5yiZL4HEJwoPFWA4cYaKZdkPVM9DZZp8Fdk4lcUrChY+mz3 bE+Y87ZvoFxJRd0V47Z9f64IuTbBB3qFPZ/VRIWgx5WP0oFTXJbEKRJ67eRHKCvwNd3V CZE4guXpuQRw3e+7AuOXii7zAmNUOZAJrrt1HnxVnsGJSoNW05UGoy7Occ9QlDNP2kUp VZP+dpLQZt10q0kJFyre2HfKDubAD2F5e9VeeX16NSOwbG3+bbFIdt2pD/kJHSdspB1o Wdpw== 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=kqI0VbPVaJfcsCTXac52W5YMJCYaSOj7FaTDjIsxYoQ=; b=PZolRu529vaqB5WD1lvDZUzVSwynnGpqizjF4TVOwIkPyEIlT+pX/vqsoebbCKpTr1 NZZ/7FUuObSOG3e7JI8BSJw2483Y3AtcaggeKWVN/Tc2lVCqyovn2agCwmuKgMmv1oBD 4u0xtaUEqI65VLduFfXUGHXuHCTXMH2E+QrhVB3ATCNR/NohLFYga0lq9N2CpByzzPqV R4MHsp7cmDHwGcpepmoGjR1rIMnUBxppXDgUvMr1WKYakQ2X/Q6Sgr/BdImevOQhfPIz Kd+UlBRiDu+IfZoRk59qyvgHJpzf9HWJ8EyelYMD4eI7hb+42E+43w+FBDkVc84r3SlU r9Yg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=RRc0Xamv; 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 i19si383531oik.272.2020.02.12.16.55.03; Wed, 12 Feb 2020 16:55:16 -0800 (PST) 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; dkim=pass header.i=@linux-foundation.org header.s=google header.b=RRc0Xamv; 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 S1729220AbgBMAyD (ORCPT + 99 others); Wed, 12 Feb 2020 19:54:03 -0500 Received: from mail-ed1-f68.google.com ([209.85.208.68]:35750 "EHLO mail-ed1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729103AbgBMAyD (ORCPT ); Wed, 12 Feb 2020 19:54:03 -0500 Received: by mail-ed1-f68.google.com with SMTP id f8so4688143edv.2 for ; Wed, 12 Feb 2020 16:54:00 -0800 (PST) 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=kqI0VbPVaJfcsCTXac52W5YMJCYaSOj7FaTDjIsxYoQ=; b=RRc0XamveMQXj/q8pfpDyw3+6RSQiI77zx4rXZCf1ovpx19fhSLX9IAuu7EAbdT6D5 hRgPzQzTBFhOQsMCJ5pC8fUtChqlceueXHqMOFdtZldjIC/GLh+J70scUbbfpK2vng/u uee+XaR52NHzT1hMiW+QFymxjV6nraNw8Kd1U= 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=kqI0VbPVaJfcsCTXac52W5YMJCYaSOj7FaTDjIsxYoQ=; b=pPXekIKvTbVSoVZc1j6WLs6YBjjjyyE76Rwefw8LbWcwUa458URMVdx7460HGrCHOU tXMwAz9YkVmyD+noQpOfe1quLbAiiwmZn6YMMZGXpU0j2LuRmsgWy8oJrGvEvtvHMbNF /uUHo5leORIdnj55+FPsJhddzu/iZtycEjEVcHQAaOXmdCrdgY3P6eCQtbtWzqqxBpiH fmMuazWuYVAP0/7ayMDpyu9ELVCimvqQ8kQtrfFYsdzrjt+y0pHMwplwNPZOd9H2Snnz huOvgx9Pto0WNUbhHsJqA5QVhGfcTBUDeCKdioClu3a5tiNgeByoJPQUOJ418kpbY/gP JFvA== X-Gm-Message-State: APjAAAXqJKN7F78t9psJ61sT5ofujSHvjBcek9SR7OUXFtWKPi874O/Z K59nPdIGFapruwivyyh7uj7OPyDOdSA= X-Received: by 2002:a17:906:d927:: with SMTP id rn7mr14016716ejb.283.1581555239665; Wed, 12 Feb 2020 16:53:59 -0800 (PST) Received: from mail-wr1-f48.google.com (mail-wr1-f48.google.com. [209.85.221.48]) by smtp.gmail.com with ESMTPSA id qh18sm50663ejb.23.2020.02.12.16.53.59 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 12 Feb 2020 16:53:59 -0800 (PST) Received: by mail-wr1-f48.google.com with SMTP id y11so4609081wrt.6 for ; Wed, 12 Feb 2020 16:53:59 -0800 (PST) X-Received: by 2002:a2e:580c:: with SMTP id m12mr9459753ljb.150.1581554910763; Wed, 12 Feb 2020 16:48:30 -0800 (PST) MIME-Version: 1.0 References: <20200210150519.538333-8-gladkov.alexey@gmail.com> <87v9odlxbr.fsf@x220.int.ebiederm.org> <20200212144921.sykucj4mekcziicz@comp-core-i7-2640m-0182e6> <87tv3vkg1a.fsf@x220.int.ebiederm.org> <87v9obipk9.fsf@x220.int.ebiederm.org> <20200212200335.GO23230@ZenIV.linux.org.uk> <20200212203833.GQ23230@ZenIV.linux.org.uk> <20200212204124.GR23230@ZenIV.linux.org.uk> <87lfp7h422.fsf@x220.int.ebiederm.org> In-Reply-To: <87lfp7h422.fsf@x220.int.ebiederm.org> From: Linus Torvalds Date: Wed, 12 Feb 2020 16:48:14 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v8 07/11] proc: flush task dcache entries from all procfs instances To: "Eric W. Biederman" Cc: Al Viro , LKML , Kernel Hardening , Linux API , Linux FS Devel , Linux Security Module , Akinobu Mita , Alexey Dobriyan , Andrew Morton , Andy Lutomirski , Daniel Micay , Djalal Harouni , "Dmitry V . Levin" , Greg Kroah-Hartman , Ingo Molnar , "J . Bruce Fields" , Jeff Layton , Jonathan Corbet , Kees Cook , Oleg Nesterov , Solar Designer 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 On Wed, Feb 12, 2020 at 1:48 PM Eric W. Biederman wrote: > > The good news is proc_flush_task isn't exactly called from process exit. > proc_flush_task is called during zombie clean up. AKA release_task. Yeah, that at least avoids some of the nasty locking while dying debug problems. But the one I was more worried about was actually the lock contention issue with lots of processes. The lock is basically a single global lock in many situations - yes, it's technically per-ns, but in a lot of cases you really only have one namespace anyway. And we've had problems with global locks in this area before, notably the one you call out: > Further after proc_flush_task does it's thing the code goes > and does "write_lock_irq(&task_list_lock);" Yeah, so it's not introducing a new issue, but it is potentially making something we already know is bad even worse. > What would be downside of having a mutex for a list of proc superblocks? > A mutex that is taken for both reading and writing the list. That's what the original patch actually was, and I was hoping we could avoid that thing. An rwsem would be possibly better, since most cases by far are likely about reading. And yes, I'm very aware of the task_list_lock, but it's literally why I don't want to make a new one. I'm _hoping_ we can some day come up with something better than task_list_lock. Linus