From: Christopher Lameter Subject: Re: SLAB_TYPESAFE_BY_RCU without constructors (was Re: [PATCH v4 13/17] khwasan: add hooks implementation) Date: Wed, 1 Aug 2018 15:15:51 +0000 Message-ID: <01000164f60f3f12-b1253c6e-ee57-49fc-aed8-0944ab4fd7a2-000000@email.amazonses.com> References: <01000164f169bc6b-c73a8353-d7d9-47ec-a782-90aadcb86bfb-000000@email.amazonses.com> <30ee6c72-dc90-275a-8e23-54221f393cb0@virtuozzo.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Cc: Eric Dumazet , Andrey Ryabinin , Linus Torvalds , Theodore Ts'o , Jan Kara , linux-ext4@vger.kernel.org, Greg Kroah-Hartman , Pablo Neira Ayuso , Jozsef Kadlecsik , Florian Westphal , David Miller , NetFilter , coreteam@netfilter.org, Network Development , Gerrit Renker , dccp@vger.kernel.org, Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Dave Airlie , To: Dmitry Vyukov Return-path: In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org List-Id: linux-ext4.vger.kernel.org On Wed, 1 Aug 2018, Dmitry Vyukov wrote: > But we are trading 1 indirect call for comparable overhead removed > from much more common path. The path that does ctors is also calling > into page alloc, which is much more expensive. > So ctor should be a net win on performance front, no? ctor would make it esier to review the flow and guarantee that the object always has certain fields set as required before any use by the subsystem. ctors are run once on allocation of the slab page for all objects in it. ctors are not called duiring allocation and freeing of objects from the slab page. So we could avoid the intialization of the spinlock on each object allocation which actually should be faster.