Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp5259129imd; Tue, 30 Oct 2018 14:36:41 -0700 (PDT) X-Google-Smtp-Source: AJdET5fr+r34ub6WXcFphwaOOP4QqtVIEAD0GIdz26hUdt9DnO8zDjKjPHz3sURyrFqfSzzqxPlZ X-Received: by 2002:a17:902:e20e:: with SMTP id ce14-v6mr408955plb.226.1540935401249; Tue, 30 Oct 2018 14:36:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540935401; cv=none; d=google.com; s=arc-20160816; b=gg02x7u+ByJAx0UolMw3DRN+/IPFuXwwcxyLhieWWnqTi+WtJAhQCkd79pqLfVyl8p U9erNyGoNdpRoytu7ozKY5Jv0RibT9ArrrpvHZAxDckyb1dRV9zc0rbI795rCuujOMyr g8UmWZfgZR5iwbz29mKN62SGVFL2SxHuQDGTccbpnebAgk5ZwlEiKmMYUQp0ieRYs0pr 2s9FxVtIL/WFASlOZmix5n6SrcHuVNrbdoQ8hQsBWTDGO8uUbn6VPYPvqNnqp/t7nnel QsXGyhJRbq94K0JUIDrkJKT9nmcmjaAlELW3WoFwGK3qH7+77HLv22nc2eAWdolQYjy6 dnVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=Kx0NVEyCmUVWEkIeDhd6Md43uB+auhhhLiJ33kVr/QI=; b=o+LbairTVbcga3Dl0G1Hao2F/gdFVH/TvDi1GrDkdXIhfWfdLUHoXyQxB7TXUXQN5l uKX82JFvxMr7LiVFcczONXnQBo0C35nRdIabFsCP+uf01WgDqGTcFN714kQ6C4RtHOFP z/qutqUShj9/qKalDIvvGCocmEkUqllO35x6bFBqQ6KFI6dnA3yBYDdduVFQRx+t5unR ZaJjq+ePcztEUBSIDHf7r7B8C7xzVnH3U6P+ZOV1r+5HmCUnT5VG5pGsX1fBZufcbuGp kHv1HUSQ7VRIkVXozVOmcyNdTVCP9J0FmSDMuPl1G7OlRTIt+4jwr1T0EIyf8eeT8lc0 R4Bw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@infradead.org header.s=bombadil.20170209 header.b=CwfXroiG; 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 f7-v6si13946817plb.362.2018.10.30.14.36.25; Tue, 30 Oct 2018 14:36:41 -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; dkim=neutral (body hash did not verify) header.i=@infradead.org header.s=bombadil.20170209 header.b=CwfXroiG; 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 S1727692AbeJaGbM (ORCPT + 99 others); Wed, 31 Oct 2018 02:31:12 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:32986 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725743AbeJaGbM (ORCPT ); Wed, 31 Oct 2018 02:31:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=aUavaxogKH403XKXRPnEVNz6RyBC+eD5hHVDUeLt+mY=; b=CwfXroiGl1iorCuN3F1tA9J1q DmMej9IeRdtCWzJcrG/znrrZpyrLbDOk53lsMNEfWiA63Uq9/ZeeN2Cu/xjfU4mmH/LaDvJcdYbax A3SIweSwoNRH5EbjUIZKqeiQ7ZYH/ZCBah5Jz5ppBhcd9EsDLaxWE4QGGm2ZXhD/ZycXZnSxehbYZ qVoGadHOYiLfYG1MDVQcVjNeMNQIq8UWJOrb0Nviai2/AG2zrGVxCuIPlqNy+yZnJnzWYPlEmbtmn YiX6eUCXcAQz2rSQYfvlcI/LOYJLDyL1q9knQS/hVljf6eM+cAmWl7Jm95obQtZ7/YDKW4WO5lsB0 AHnRlXlkg==; Received: from willy by bombadil.infradead.org with local (Exim 4.90_1 #2 (Red Hat Linux)) id 1gHbg5-0004UL-KK; Tue, 30 Oct 2018 21:35:57 +0000 Date: Tue, 30 Oct 2018 14:35:57 -0700 From: Matthew Wilcox To: Igor Stoppa Cc: Tycho Andersen , Andy Lutomirski , Kees Cook , Peter Zijlstra , Mimi Zohar , Dave Chinner , James Morris , Michal Hocko , Kernel Hardening , linux-integrity , linux-security-module , Igor Stoppa , Dave Hansen , Jonathan Corbet , Laura Abbott , Randy Dunlap , Mike Rapoport , "open list:DOCUMENTATION" , LKML , Thomas Gleixner Subject: Re: [PATCH 10/17] prmem: documentation Message-ID: <20181030213557.GE10491@bombadil.infradead.org> References: <20181028183126.GB744@hirez.programming.kicks-ass.net> <40cd77ce-f234-3213-f3cb-0c3137c5e201@gmail.com> <20181030152641.GE8177@hirez.programming.kicks-ass.net> <0A7AFB50-9ADE-4E12-B541-EC7839223B65@amacapital.net> <20181030175814.GB10491@bombadil.infradead.org> <20181030182841.GE7343@cisco> <20181030192021.GC10491@bombadil.infradead.org> <9edbdf8b-b5fb-5a82-43b4-b639f5ec8484@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <9edbdf8b-b5fb-5a82-43b4-b639f5ec8484@gmail.com> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Oct 30, 2018 at 10:43:14PM +0200, Igor Stoppa wrote: > On 30/10/2018 21:20, Matthew Wilcox wrote: > > > > So the API might look something like this: > > > > > > > > void *p = rare_alloc(...); /* writable pointer */ > > > > p->a = x; > > > > q = rare_protect(p); /* read-only pointer */ > > With pools and memory allocated from vmap_areas, I was able to say > > protect(pool) > > and that would do a swipe on all the pages currently in use. > In the SELinux policyDB, for example, one doesn't really want to > individually protect each allocation. > > The loading phase happens usually at boot, when the system can be assumed to > be sane (one might even preload a bare-bone set of rules from initramfs and > then replace it later on, with the full blown set). > > There is no need to process each of these tens of thousands allocations and > initialization as write-rare. > > Would it be possible to do the same here? What Andy is proposing effectively puts all rare allocations into one pool. Although I suppose it could be generalised to multiple pools ... one mm_struct per pool. Andy, what do you think to doing that? > > but we'd probably wrap it in list_for_each_rare_entry(), just to be nicer. > > This seems suspiciously close to the duplication of kernel interfaces that I > was roasted for :-) Can you not see the difference between adding one syntactic sugar function and duplicating the entire infrastructure?