Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932207AbbFIDFb (ORCPT ); Mon, 8 Jun 2015 23:05:31 -0400 Received: from mail-qg0-f46.google.com ([209.85.192.46]:34298 "EHLO mail-qg0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751335AbbFIDFW (ORCPT ); Mon, 8 Jun 2015 23:05:22 -0400 Message-ID: <557657EE.80809@kernel.dk> Date: Mon, 08 Jun 2015 21:05:18 -0600 From: Jens Axboe User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Rasmus Villemoes , Andrew Morton , Steven Rostedt , Ingo Molnar CC: Joe Perches , Al Viro , linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 3/8] blktrace: use strreplace in do_blk_trace_setup References: <1433806017-10823-1-git-send-email-linux@rasmusvillemoes.dk> <1433806017-10823-4-git-send-email-linux@rasmusvillemoes.dk> In-Reply-To: <1433806017-10823-4-git-send-email-linux@rasmusvillemoes.dk> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1997 Lines: 39 On 06/08/2015 05:26 PM, Rasmus Villemoes wrote: > Part of the disassembly of do_blk_trace_setup: > > 231b: e8 00 00 00 00 callq 2320 > 231c: R_X86_64_PC32 strlen+0xfffffffffffffffc > 2320: eb 0a jmp 232c > 2322: 66 0f 1f 44 00 00 nopw 0x0(%rax,%rax,1) > 2328: 48 83 c3 01 add $0x1,%rbx > 232c: 48 39 d8 cmp %rbx,%rax > 232f: 76 47 jbe 2378 > 2331: 41 80 3c 1c 2f cmpb $0x2f,(%r12,%rbx,1) > 2336: 75 f0 jne 2328 > 2338: 41 c6 04 1c 5f movb $0x5f,(%r12,%rbx,1) > 233d: 4c 89 e7 mov %r12,%rdi > 2340: e8 00 00 00 00 callq 2345 > 2341: R_X86_64_PC32 strlen+0xfffffffffffffffc > 2345: eb e1 jmp 2328 > > Yep, that's right: gcc isn't smart enough to realize that replacing > '/' by '_' cannot change the strlen(), so we call it again and again > (at least when a '/' is found). Even if gcc were that smart, this > construction would still loop over the string twice, once for the > initial strlen() call and then the open-coded loop. > > Let's simply use strreplace() instead. Patch looks fine to me, but there's no strreplace in in Linus' tree. Dependencies like that should be noted in the patch. Please send followup patches like this when the main patch is in Linus tree, and I'd be happy to apply it. -- Jens Axboe -- 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/