Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp382032imm; Thu, 31 May 2018 02:05:51 -0700 (PDT) X-Google-Smtp-Source: ADUXVKI475ZDSrZXnZice41P+uvJShaIvYVuvoaQOyqn1sA9n33jyT78cm7V1tOwVC81sjjozKl1 X-Received: by 2002:a62:9804:: with SMTP id q4-v6mr6047735pfd.65.1527757551665; Thu, 31 May 2018 02:05:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527757551; cv=none; d=google.com; s=arc-20160816; b=xjKvGe5ggJw3oWM1Z+GBWmise8PUZPeIGZp3MfBTnWlFWqa/dNJZdWAnoi/OJEfDyw 9b2+Iy/niHZIPKX7ixoY/hyufjRXf8TxAZIhliXL2H31c8WhXBHbQeJlWLfG6DjmATbz dPH9dIUz/ti9q+aGi4TJ1rn0D1e1dWcrEa/2WKHHlEr8aweKb2tKHMhNXqaESS6Xcqjg XGt3guPM8G5tM0rGBQkdAjZj3qpU2eq3aVNXnHL0KjzIk4dSSAEDDXnl3RD6c6sqfH1e 6Xtj2mq9dv7hEYlf0C/CCx5eVocO/PRCGtDwgZke7ndCe4b0A1pmeq3iMYHOggpe7Ual 8PSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:to:subject:arc-authentication-results; bh=W7iZ0gLmdQeIoCR5+CDbpMNd8Cgp6lNJrcAxs7Abjbw=; b=y49hBROnTjsI+8zfM7z1edkRJB9QbF4yRZQrvflbF+IsOumfUs0hUldWhRGHvxT82I Up/V+SAm0QkUVa4KXpe0eIYJq1TekSf9tL2ZxVvtprVmCqzGn4mn6WppMpvlp8VswTpq G9zP8AsV13Hk3kuyoxb408/xQ2dLq0ca+Iyo/v9v8UebnLgvRIrakX+iq+K17p/NVKsQ /mXiolYz3H7+3frR/qPJFYRveLoLYkGR3n99hAdXaOtjDWq+Ni9PTzkqAl0LwGrvwPr3 /yg/eNXxZA81NwEXExe2ZTsqUH+IercMKXmHWv1DWaY2Zn0yXj9s1vwDQPgjs0RlWY/J 7zOA== ARC-Authentication-Results: i=1; mx.google.com; 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 3-v6si37577074plf.84.2018.05.31.02.05.37; Thu, 31 May 2018 02:05:51 -0700 (PDT) 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; 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 S1754164AbeEaJEv convert rfc822-to-8bit (ORCPT + 99 others); Thu, 31 May 2018 05:04:51 -0400 Received: from seldsegrel01.sonyericsson.com ([37.139.156.29]:19267 "EHLO SELDSEGREL01.sonyericsson.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754026AbeEaJEr (ORCPT ); Thu, 31 May 2018 05:04:47 -0400 Subject: Re: [PATCH V3 0/5] selinux:Significant reduce of preempt_disable holds To: Stephen Smalley , Paul Moore , Eric Paris , James Morris , Daniel Jurgens , Doug Ledford , , , , "Serge E . Hallyn" , "Paul E . McKenney" References: <20180530141104.28569-1-peter.enderborg@sony.com> <8bbb095e-31c3-0062-d17c-662e4832cc17@tycho.nsa.gov> From: peter enderborg Message-ID: <1cf240b9-57ee-eee3-228f-5ad4a3a39e57@sony.com> Date: Thu, 31 May 2018 11:04:43 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <8bbb095e-31c3-0062-d17c-662e4832cc17@tycho.nsa.gov> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8BIT Content-Language: en-GB Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 05/30/2018 10:34 PM, Stephen Smalley wrote: > On 05/30/2018 10:10 AM, Peter Enderborg wrote: >> The boolean change becomes a lot more heavy with this patch, >> but it is a very rare usage in compare with read only operations. >> The lock held during a policydb_copy is about 1ms on a XEON. > This has a very substantial performance impact on setsebool, e.g. time setsebool httpd_can_sendmail=1. > That's because you are doing a full vmalloc();policydb_write();policydb_read();vfree() sequence on it. > In comparison, KaiGai's old attempt to replace the policy rwlock with RCU only duplicated the conditional policydb state (via a cond_policydb_dup) that he introduced. Is there a reason you couldn't use that approach? That one did not make it, so I went for a other path. Make it simple, using the same serialisation that exist. That also make it easier to maintain. We do not  use the booleans in android since they are not allowed so im not aware of any use case where this administrative function are used in such frequent manner that it would have an impact. And it must be some other large overhead with interprocess communication and a multiple writes to sysfs during a boolean settings?  However my concern is/was memory pressure, setting booleans will generate pressure with lot of atomic allocation and large vmallocs. But my goal is the fast path for real time critical functions such as audio, and it will be a cost for administrative tasks. On the xeon it takes about ~98 ms to run the security_set_bools compared to about ~8 ms without the overhead of copying the policydb.  About ~6 ms is rcu sync and ~8 ms is the same as the original update of selinux statuses, and about ~25 ms is policydb_destroy() of the old copy. >