Received: by 2002:a05:6358:111d:b0:dc:6189:e246 with SMTP id f29csp109714rwi; Sun, 30 Oct 2022 21:28:52 -0700 (PDT) X-Google-Smtp-Source: AMsMyM62jZSu7gp3zjMQm58KL/hgRPxlkCfCs7Y5jHAICTIJNfN/M60F2/kqsA3xc3JXzmKq7TLy X-Received: by 2002:a17:907:72d3:b0:791:a4fa:c4ac with SMTP id du19-20020a17090772d300b00791a4fac4acmr11086375ejc.391.1667190532042; Sun, 30 Oct 2022 21:28:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667190532; cv=none; d=google.com; s=arc-20160816; b=nzu/c+8b7tnjWhC2bOxp5dgFLFBeowFIyJQ9GW187+VOB4K7D/qEDMH/oBuAPvSpMu tIImsPyyDoOmXaNaJGpig0jEfz4N97QAQwM8qSTi2rRYWu5oU4puZv6YBf56PBVKf348 dk5cbnwOM609szfkN7C9g36TP9W915igdpah+rP6ZTGgBqhiXvgA27aNbifS96GLnEzt NK2y5g2ASSa/Xhk9A0Nb6OM0ZpOv3vp07hLayAsllnrCu/gnY87Jz5EbDZZ5+oXd50AB HR6AkWScIpIfjXC+VHFVBQUmDOlZvzIw4InDRFlbwr02B2oQUs1+R3iXiitChT8jMXFl xuIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :organization:from:references:cc:to:content-language:subject :user-agent:mime-version:date:message-id:dkim-signature; bh=VVJbZrf0diiwoA5FEx2u/I6vnvmh4+0O7MKR0BSmx5Q=; b=JYg1zl2AIHgZs1Nnuom5xpAESQGlfZmix96XikxCjHDjUDwVOlEC6r7G0PKuU1G4h5 wnDKah90u8kkqwuIjTdAZSiK7OhmdMVtC82mT8WDETlmYDcEZDfbmn7cGwVOqrsTQfgN NMOl5PE1rznb2NNMb/TKXZaD2790p66FfbVEHr5EbPxxkQx8OulW55BoUatEySt3FrEs 2/WqJl552VRpEeWOChMQ8BjhmVEU7xAUQuBLHUDOdMJIi20Zx0QYIou9bZNbmlBiLpMk KS+1qiPipKQJWEUYm/lVN6Ohz4ptmk3X3njTuNfv9qGx8SmsoSqwGGQ3nO2DwqXXa6lK 4j9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b=o+MZYoXR; 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=canonical.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dp18-20020a170906c15200b007824b741e7asi8187080ejc.236.2022.10.30.21.28.28; Sun, 30 Oct 2022 21:28:52 -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=@canonical.com header.s=20210705 header.b=o+MZYoXR; 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=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229783AbiJaDzz (ORCPT + 99 others); Sun, 30 Oct 2022 23:55:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52538 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229663AbiJaDzy (ORCPT ); Sun, 30 Oct 2022 23:55:54 -0400 Received: from smtp-relay-canonical-0.canonical.com (smtp-relay-canonical-0.canonical.com [185.125.188.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 58B30E49; Sun, 30 Oct 2022 20:55:53 -0700 (PDT) Received: from [192.168.43.182] (unknown [62.168.35.125]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-canonical-0.canonical.com (Postfix) with ESMTPSA id 620A9422D3; Mon, 31 Oct 2022 03:55:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1667188550; bh=VVJbZrf0diiwoA5FEx2u/I6vnvmh4+0O7MKR0BSmx5Q=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=o+MZYoXRBKxjIz6pKgBIC5GRfmun4LVBcWxoshZGsTJe3z6wUaMieqKothCRNMANC dJ1MBxCsU0cqc5iue86xjoD5xIrthoQkWHzTX3EDbL5QS8ly9HZQ/yf/OaNsVPyVSQ B4pngtYZQWTq4nHXAe0bGqsmjjy90k9VjYU/hiqEXGjjsDWmfL3ODTDMA35rQrF6qQ faAek33UcEiw5S0+EQc/+AWkZuh6DVekHb+2rd3/W9jr99IvhatbcK2Rlo+iEmHzbR DaAHNQ4Y9oY32Rf2y8apFXWegy3JO7uVf2q/LT7AbB9VQHkAVokZZz03JHOKHiMPBJ RrRfnZt1Z+hhA== Message-ID: Date: Sun, 30 Oct 2022 20:55:49 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.2 Subject: Re: apparmor: global buffers spin lock may get contended Content-Language: en-US To: Sergey Senozhatsky Cc: Sebastian Andrzej Siewior , Peter Zijlstra , Tomasz Figa , linux-kernel@vger.kernel.org, linux-security-module@vger.kernel.org References: From: John Johansen Organization: Canonical In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-5.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_MED,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 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