Received: by 2002:a05:6358:111d:b0:dc:6189:e246 with SMTP id f29csp127005rwi; Sun, 30 Oct 2022 21:51:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4MxZJXfbjBvwmrItzBEUUaaQAG3VAa8pDfK+LfNKsBQQHWME3mf0fyDd63ePK0Z0vR6Rhx X-Received: by 2002:aa7:88c9:0:b0:56b:e851:5b67 with SMTP id k9-20020aa788c9000000b0056be8515b67mr12244976pff.78.1667191911807; Sun, 30 Oct 2022 21:51:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667191911; cv=none; d=google.com; s=arc-20160816; b=fP5XTUDabKojo9YKvZwLyHMvqGFh/M/CUDUIbxSe4GwTfK4qEpzO2qYg4RC63AU/G8 dLsogil1YtGtcp6t5fTwIK/Zr46n19DMFlQ5HM9JfXHJ4rb3/9iyxWbpz6Bo4xtPk0vj pkDGUcWXqs3Z6wiQhxqz9IyA14ZhDuvSu7RBD6wLX9pTOeVQNacKQzW+0HDrCTKHT4dA 6A6Ufr4di68ewgNV6wPzKsk6Af8eqH+BhGe3ijqEz591IHC9YkDBprUQmPsrKYce8e4k OBOBYqambof0wlc0IDlsC1H5qeHEI4JNWowHJRhFBFKwvxswAFC8Y4j0nTRkeuIBBbV8 eL9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=QvB6GEhcvHb8LBDNupJUpWNS+VEp7MFsv/1LrElM5EA=; b=qpZSQAZvFxSDMCNEH9EMPrsgOplCSX3aJ+5CrrEKgKSUKZI/icVpF2+boe3Ks6rAe7 hVz/8JDuSfzh1Kexu4ZF7NbjSAGIxDnM0krbfw+16LxomsnzaOeeII0iC1MWUtRAQCTR BUwjzYjgrRmuFrc5cpgVq/7bVJwnA2OEK9PjYift4Uz9+zKl36DRlwtRMWkYQ2z1S7Zb DLtC/rI9ddZqyjcJk2JJMyS9ePJRpTI7p267wFgD9RsJ/pCgWH2d15Bwhb8XpapnKx2F Gi3xIAR6SOuE0IZ20I241TneriW8DH8pZd7eqq/Opjmaqw/ofm9vwiKIB0owSK2LCvRw SBOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=e41yXHTb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ng13-20020a17090b1a8d00b00213d630f487si3998618pjb.62.2022.10.30.21.51.38; Sun, 30 Oct 2022 21:51:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=e41yXHTb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229480AbiJaEEW (ORCPT + 99 others); Mon, 31 Oct 2022 00:04:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54002 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229469AbiJaEEV (ORCPT ); Mon, 31 Oct 2022 00:04:21 -0400 Received: from mail-pf1-x42f.google.com (mail-pf1-x42f.google.com [IPv6:2607:f8b0:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 20F177662 for ; Sun, 30 Oct 2022 21:04:20 -0700 (PDT) Received: by mail-pf1-x42f.google.com with SMTP id b29so9611184pfp.13 for ; Sun, 30 Oct 2022 21:04:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=QvB6GEhcvHb8LBDNupJUpWNS+VEp7MFsv/1LrElM5EA=; b=e41yXHTbx8iQZaHXMmRxz7gEPbUjUa5mMwbt6Lt+s8zRo2DTPob1zvK/rO4qfOk1pW aoWf5DKwhW0jcVw6ABwlGHFlNeV/awFrCYcNaww0RcqWmkYVQSkzJQJGoNcVty1Fg23i iJLGAYzqTNmgBddzAKuUjDX0Xg1Ng9nMG5IWc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=QvB6GEhcvHb8LBDNupJUpWNS+VEp7MFsv/1LrElM5EA=; b=fud3c5MOjsQzr5dkJfNLKh97Ds1UP6BG+rBqZMYXg+z6dT9svZzN0r/3yiqqi6Nsmb dFZ5dG6CJ5R5iCO6seLa3UjqiQFqwZKQuImagS+fh+CPudvZrRxdZb4oIXG677Drq0I0 XoIfTPf4+lGWXU7Zz5I3OO0xWylmrGnYrHU7mer10uCrPA6oaCF/+hShMBCx+d8ZEi4j fvsn2yvVNyisioentYEQbTdNlp818/TvHjDA9C6kTOpDBkgjm0S873/19b2Wa4Rc6ybG NK72kEhsh6zP51PR1HqwbQfw6whIK6/jHX3jG5/7bMNnwh048tTpd1cImnt/eyeqH+Ab zClw== X-Gm-Message-State: ACrzQf3OjVE+e/Fn7eAwoP9IUVVUrJT6m0N28wtkVUkGSSlYW1iwJJj+ +NSbZTw1kZypN5X7eDYfU00GWw== X-Received: by 2002:a62:b40a:0:b0:56c:6c63:fdb2 with SMTP id h10-20020a62b40a000000b0056c6c63fdb2mr12308335pfn.4.1667189059638; Sun, 30 Oct 2022 21:04:19 -0700 (PDT) Received: from google.com ([240f:75:7537:3187:f624:9e85:ec7a:fa29]) by smtp.gmail.com with ESMTPSA id m2-20020a17090a7f8200b001faafa42a9esm3135266pjl.26.2022.10.30.21.04.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 30 Oct 2022 21:04:19 -0700 (PDT) Date: Mon, 31 Oct 2022 13:04:14 +0900 From: Sergey Senozhatsky To: John Johansen Cc: Sergey Senozhatsky , Sebastian Andrzej Siewior , Peter Zijlstra , Tomasz Figa , linux-kernel@vger.kernel.org, linux-security-module@vger.kernel.org Subject: Re: apparmor: global buffers spin lock may get contended Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-3.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On (22/10/30 20:55), John Johansen wrote: > On 10/30/22 20:52, Sergey Senozhatsky wrote: > > On (22/10/28 02:34), John Johansen wrote: > > > From d026988196fdbda7234fb87bc3e4aea22edcbaf9 Mon Sep 17 00:00:00 2001 > > > From: John Johansen > > > Date: Tue, 25 Oct 2022 01:18:41 -0700 > > > Subject: [PATCH] apparmor: cache buffers on percpu list if there is lock > > > contention > > > > > > On a heavily loaded machine there can be lock contention on the > > > global buffers lock. Add a percpu list to cache buffers on when > > > lock contention is encountered. > > > > > > When allocating buffers attempt to use cached buffers first, > > > before taking the global buffers lock. When freeing buffers > > > try to put them back to the global list but if contention is > > > encountered, put the buffer on the percpu list. > > > > > > The length of time a buffer is held on the percpu list is dynamically > > > adjusted based on lock contention. The amount of hold time is rapidly > > > increased and slow ramped down. > > > > > > Signed-off-by: John Johansen > > > > Reported-by: Sergey Senozhatsky > > yep, thanks for catching that Thanks for the patch! Unfortunately it'll be a bit difficult to test it right now; I'll probably have to wait until corp pushes new kernel (with the patch) to build boxes.