From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756814AbZBWAL1 (ORCPT ); Sun, 22 Feb 2009 19:11:27 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754397AbZBWALT (ORCPT ); Sun, 22 Feb 2009 19:11:19 -0500 Received: from one.firstfloor.org ([213.235.205.2]:59539 "EHLO one.firstfloor.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754259AbZBWALS (ORCPT ); Sun, 22 Feb 2009 19:11:18 -0500 Date: Mon, 23 Feb 2009 01:29:18 +0100 From: Andi Kleen To: Steven Rostedt Cc: Andi Kleen , linux-kernel@vger.kernel.org, Ingo Molnar , Andrew Morton , Thomas Gleixner , Peter Zijlstra , Frederic Weisbecker , Linus Torvalds , Arjan van de Ven , Rusty Russell , Mathieu Desnoyers , "H. Peter Anvin" , Steven Rostedt Subject: Re: [PATCH 4/6] ftrace, x86: make kernel text writable only for conversions Message-ID: <20090223002918.GQ26292@one.firstfloor.org> References: <20090220011316.379904625@goodmis.org> <20090220011521.003556651@goodmis.org> <87y6vyuzsn.fsf@basil.nowhere.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.1i Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > We are changing over 19000 locations in the kernel. This touches almost > all kernel text pages anyway. You want to map a page in and out for over > 19000 locations? Well kernel size / PAGE_SIZE times if you sort locations first and take a last-hit cache. Or if you want to overoptimize you can also use 2MB pages when available. Also it can be done much cheaper than a full flush because it doesn't need to be global over all CPUs (assuming you disable preempt, which you probably do anyways) And it can use INVLPG on x86 (or similar directed flushed) which is much much cheaper than blowing everything away. I'm not sure which one would be faster, but I suspect the difference will not be very large. And not changing the kernel has the advantage that there is no window where it is unprotected. -Andi -- ak@linux.intel.com -- Speaking for myself only.