Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758332AbYG1Pwj (ORCPT ); Mon, 28 Jul 2008 11:52:39 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752144AbYG1Pwa (ORCPT ); Mon, 28 Jul 2008 11:52:30 -0400 Received: from smtp1.linux-foundation.org ([140.211.169.13]:34889 "EHLO smtp1.linux-foundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751497AbYG1Pwa (ORCPT ); Mon, 28 Jul 2008 11:52:30 -0400 Date: Mon, 28 Jul 2008 08:48:41 -0700 (PDT) From: Linus Torvalds To: Vitaly Mayatskikh cc: linux-kernel@vger.kernel.org, Andi Kleen , Ingo Molnar Subject: Re: [PATCH] x86: Optimize tail handling for copy_user In-Reply-To: Message-ID: References: User-Agent: Alpine 1.10 (LFD 962 2008-03-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 985 Lines: 26 On Mon, 28 Jul 2008, Vitaly Mayatskikh wrote: > > Reduce protection faults count in copy_user_handle_tail routine by > limiting clear length to the end of page as was suggested by Linus. No, you did it wrong. The page _clearing_ has to be to the end of the copy. Yes, in practice, I don't think the kernel actually very often does "copy_from_user()" calls that are page crossers in the kernel, but they do happen. It's the _copy_ part that needn't cross pages, because we know that something faulted, and we _know_ that it wasn't the clearing. Really: the clearing should be just a "memset()" with no limitations. It can never fault without it being a serious bug, and then we should not fix it up, but we should oops! Linus -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/