Received: by 2002:a05:6358:111d:b0:dc:6189:e246 with SMTP id f29csp148657rwi; Sun, 30 Oct 2022 22:18:47 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5UDz7CQSlExav9KbkQ7j0A8Kxvnt8JQM28WfIxomZLbWN8QuNgN6tBS4978y1Abpa5mXvz X-Received: by 2002:a17:90a:13:b0:212:d139:748a with SMTP id 19-20020a17090a001300b00212d139748amr12627650pja.182.1667193526671; Sun, 30 Oct 2022 22:18:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667193526; cv=none; d=google.com; s=arc-20160816; b=gvqqmqgYf6P6iemlF8LVKbMejqKXSOjILp6AltfhT/yiyC5+jBke6bNRu6KbbuR5EG k15IEIn6KiIs3snvQyobebtBN6GjsrFGcvQqs3g13w0oHZzQi3KXkWW5npS+vZfVl1BJ Zi61u/rtp11MATN5gscaBLpLTiZ5jxbppYMEHHPYLblI+B2LEJKtpWbbYYtUFo8oI/vA pAG04L4YnNm6ECSamYm/EalNqFh604NAELMuD/qKMfQJ1yzhk0np2PsL9EXujBGlqqBT MqMB73s0VA6BynouP9npu7hl+fO9Y+nUrK0ZLXhKGC/YQTd3rTfJ7Fjmv+v9zq0dfs2x hQkw== 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=I21cCJCWzwa8h49wcXGzeXQhOZvvflCzQcd6UuE2zWU=; b=IH6IEo4uKYMnx8lszq++2KVP8nRl0tCbdxHYQD+oC+XQARsQr9szS4OPQsUlcu/8Zc 7BaN9fubE6N6l8KG/FWH/Pwkg53ILZw6VpPuqQXbSXGbLVRVph3Hr2bpE59iqmy88MOX sNz0eWxJKXF6GuP4ix6UyrZiGkCl7xcfZ1jgLnl0eF+JhavwHB1nzkhJ3olMuPMm5b1S 4Kpm5GHLvOg4msSr1BNiZ18WK944NjJLNi0awl1f78BfohNfssg3+wFXbay+XT6U+S74 uUK596w4EPMR9L3x5xjVF8bRasJZL/bA9TJTtb9nNZ87WTNuD8O1dVw53qE80nI20/Z0 RWtA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=KL2LH3b4; 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 b8-20020a170902e94800b00180d51f70cfsi8095724pll.107.2022.10.30.22.18.28; Sun, 30 Oct 2022 22:18:46 -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=KL2LH3b4; 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 S229743AbiJaDwr (ORCPT + 99 others); Sun, 30 Oct 2022 23:52:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49736 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229542AbiJaDwo (ORCPT ); Sun, 30 Oct 2022 23:52:44 -0400 Received: from mail-pj1-x1030.google.com (mail-pj1-x1030.google.com [IPv6:2607:f8b0:4864:20::1030]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CFFFE6148 for ; Sun, 30 Oct 2022 20:52:42 -0700 (PDT) Received: by mail-pj1-x1030.google.com with SMTP id 3-20020a17090a0f8300b00212d5cd4e5eso14778077pjz.4 for ; Sun, 30 Oct 2022 20:52:42 -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=I21cCJCWzwa8h49wcXGzeXQhOZvvflCzQcd6UuE2zWU=; b=KL2LH3b4va5k6gTuWpyglwWk9uIF/pxPF8vz5wfF9STqAI4VNHhFwJbnm7iv1gD+wQ DLtFxxalLnDbYfw7+9J6SOiCGvlfIIZRgsJ1cxb8iMH77oElt2+eLpXxIeJOTFzuqjI8 hS8E6st+Bf0kXUaz0uAJmS/WtsnS009LRV/FY= 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=I21cCJCWzwa8h49wcXGzeXQhOZvvflCzQcd6UuE2zWU=; b=OFVuEIIS1ZiC5nNldRVcAG4VVqmBSNuqnFef1tPO87umUpkX9X2R+ke6jFnMHyWMR+ aeFZp9zAKgGMWDkXr4MKnGY32AJbEIowJFtuQ/7r7qau86RH2TfuId0EREYHnRLmlmzJ L5gXEWrysa9EjlKAnDwheLTOeugA4FbJwtWdUK1OVpDhI8tDMzmPm7OicSgDKBgnN/QM DPAzuxhXYBuXTA1xCpeKCJxl7Vf5I5qMygB2MXv6+LB5ycF6c8p0/FWaGxgLgzVyY2nD SBHHFiV1n1+AfQgQukGn7iTggy6qO6qQP7x74vhdSDpIOqZdZfngH5h2L7K+n4azmSkQ a1lQ== X-Gm-Message-State: ACrzQf1ir8dQy+pcdww/IhMxdSbDHeQ3C/AdZvy23d5VgDkOXqbieCkT RUR5PxUkQfNo0SlwDruexuDpx66Hqik0Uw== X-Received: by 2002:a17:903:40cb:b0:187:1d3:461a with SMTP id t11-20020a17090340cb00b0018701d3461amr11960773pld.155.1667188362334; Sun, 30 Oct 2022 20:52:42 -0700 (PDT) Received: from google.com ([240f:75:7537:3187:f624:9e85:ec7a:fa29]) by smtp.gmail.com with ESMTPSA id x1-20020a17090a294100b0020d67a726easm3120676pjf.10.2022.10.30.20.52.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 30 Oct 2022 20:52:41 -0700 (PDT) Date: Mon, 31 Oct 2022 12:52:37 +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/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