Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp5288366imd; Tue, 30 Oct 2018 15:10:00 -0700 (PDT) X-Google-Smtp-Source: AJdET5etrU8gdJA8J6GLmqAqVPDOXtU7+mV+rn5H4sod013rsGCdmTVqveBPZYVGAc5wWDYIHkMA X-Received: by 2002:a17:902:6a:: with SMTP id 97-v6mr489037pla.276.1540937400077; Tue, 30 Oct 2018 15:10:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540937400; cv=none; d=google.com; s=arc-20160816; b=IBcU90ZIkczlQE0SIbr1lWkElJ4iQTTYq1zowSKU9HJYcwHvavy0bVVP6TnO24IkNz NzvbYB5gAsUg/lT2emIJMCzh21LjlYfNLWQmf0dH+JZGC/wTQDdL3EnWzmXWysCTMpKU X3Wic+deJGLuKrUkaf16s2nPk98fZ3S2VjQeqK6qkGPPR+koIEQjyVSJwuhdgRZgFuin Lm9b6zV6e0UNJ/965PA1BzcYzKvywaQxTXeyZbha/1bRJLSoQAO/uzfAux0xPlxHw1l8 9uELigPpmeD6YJvWxjpfYXe2VtK/Eaw8y9hel6EvaqF3pZUJJDfnzYKZDoSU4o6D2pYP 2otA== 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-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=9HsO2khZ0MbzoRWq5VhqQW+lsDypsc7reBiq9uyPhDE=; b=oHO270wrGF3oKYjSepaXboImUq6sdYY2s2hY+FeIfaJMPz9uorj9CvsGLV/5/uypRq HYO5Qd5zCtEisSGekpSGq1paI7kOuE0GeIgsJQiAn6MENHBBrAJJOBMx85X4TZRU+hfu pFEUvYQZvIa2PS2KlkQjUdIXBe68UeY2xFIU43HHFEnaqtYR9AyOcOD5qgWPyn4HzyKr i1FMsJJdDu+UhLzsdhVPG2szzVTbxm8fVlumrxciTduNSUX8BWV6lAoMxT6VjVu25t6x xTJpUWZEE3yBls8vbS3OEWk76eV5xXtUwVXA3h+isgw+813HalcfiYVkhO5nhrJgL04I OguQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=oZUEqDP7; 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 b9-v6si25228466pgh.440.2018.10.30.15.09.43; Tue, 30 Oct 2018 15:10:00 -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=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=oZUEqDP7; 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 S1728504AbeJaHES (ORCPT + 99 others); Wed, 31 Oct 2018 03:04:18 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:39434 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728491AbeJaHER (ORCPT ); Wed, 31 Oct 2018 03:04:17 -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-Transfer-Encoding :Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Sender:Reply-To: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=9HsO2khZ0MbzoRWq5VhqQW+lsDypsc7reBiq9uyPhDE=; b=oZUEqDP7nN3We7XktLLu71bDuR P7+9AvpCLjl5Jk5dZWcPftmm4Ijm6EbTedMNOA1fOfH70uuzYGNY0qxZuOmuQB+W4hNOMCo5t6NpX Sjps9B4Jxkq1rDIl+fI0W2NTHVLX0+8sqpXoSHOW/eXgJJM8gXhhXeATS1oKiNREcvYA8z3Z+gkUV /YkUP3g42+eng0fjkP5jOKS6Y5P6RtIK3nVzBL7OjH3PFNKKjiAozXo5eEh9TxNEd/78GaiLMhwEF 7FAgtOZcSl4ezJcj/K3KAfZco1j81c9KX0Inxi+xuwpy0dTnt5gs5uflbqVbzYniC4uh3GgqROHjZ 2R/sMU1w==; Received: from willy by bombadil.infradead.org with local (Exim 4.90_1 #2 (Red Hat Linux)) id 1gHcC3-0005hL-Je; Tue, 30 Oct 2018 22:08:59 +0000 Date: Tue, 30 Oct 2018 15:08:59 -0700 From: Matthew Wilcox To: Igor Stoppa Cc: Andy Lutomirski , nadav.amit@gmail.com, 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: <20181030220859.GF10491@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> <28C8CD2A-BDC0-49A5-854E-1E18968528B8@amacapital.net> <20181030212551.GD10491@bombadil.infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: 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 11:55:46PM +0200, Igor Stoppa wrote: > On 30/10/2018 23:25, Matthew Wilcox wrote: > > On Tue, Oct 30, 2018 at 11:51:17AM -0700, Andy Lutomirski wrote: > > > Finally, one issue: rare_alloc() is going to utterly suck > > > performance-wise due to the global IPI when the region gets zapped out > > > of the direct map or otherwise made RO. This is the same issue that > > > makes all existing XPO efforts so painful. We need to either optimize > > > the crap out of it somehow or we need to make sure it’s not called > > > except during rare events like device enumeration. > > > > Batching operations is kind of the whole point of the VM ;-) Either > > this rare memory gets used a lot, in which case we'll want to create slab > > caches for it, make it a MM zone and the whole nine yeards, or it's not > > used very much in which case it doesn't matter that performance sucks. > > > > For now, I'd suggest allocating 2MB chunks as needed, and having a > > shrinker to hand back any unused pieces. > > One of the prime candidates for this sort of protection is IMA. > In the IMA case, there are ever-growing lists which are populated when > accessing files. > It's something that ends up on the critical path of any usual performance > critical use case, when accessing files for the first time, like at > boot/application startup. > > Also the SELinux AVC is based on lists. It uses an object cache, but it is > still something that grows and is on the critical path of evaluating the > callbacks from the LSM hooks. A lot of them. > > These are the main two reasons, so far, for me advocating an optimization of > the write-rare version of the (h)list. I think these are both great examples of why doubly-linked lists _suck_. You have to modify three cachelines to add an entry to a list. Walking a linked list is an exercise in cache misses. Far better to use an XArray / IDR for this purpose.