Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp2235439ybl; Thu, 29 Aug 2019 05:37:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqwUGgGKq/58krfwhOo9bX789sUqxVJ88IKxPQgTbIQs5EwIoJh6eqKS9IJq6B/tg8w4oT+u X-Received: by 2002:a62:38d7:: with SMTP id f206mr11231703pfa.102.1567082260962; Thu, 29 Aug 2019 05:37:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567082260; cv=none; d=google.com; s=arc-20160816; b=Yewj8Obd02E6Q5KuziUQg4VmHREqaFjoZNBaAeGLXC8UJahUvL2Efi8DenOmEd3am+ NciRLHdcCmTFBSEfrTshrGo1d+ZYJ1EUKFwC7swqSjyf27FAAiWHwADczvnL/LyB2Q70 Iz1kCVdgB3u/7ZQwJqFEZ2fXHF2Wn5PNBvG2XtxYJJJgUlZc0nzolHXNSs9AOwqBsu9g LoDS4AqPxGkIapH/dxRwrcyELOf3W0qsM3twgQ+IaV5KcfnlUdcNoFYyj5l6nwJR1URt YWpwIfEmsmnIf7EBadzD5RcpGXbFdCiWSEQEIwaf6tVlt4SFY2a6pQbkXclYXhXpH13d 1omw== 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-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=jyG+3RbyVo0ge5+B2Y+V/QY+BuDVjerDhPABGwRD/k8=; b=q+qv0qjikT629nEzMoD7bL73WHgw6WDpYEH3dhrBoSTyALxOJHwMX6izBtOY+IvLRd 37mQc9bJ3pfK0y/Yq3ZURwks21hYLdJVr6RjiNA/Dey4OkN4wFNgi4GeWSCZQWtn9QRp xgM0rc7D02GSJ8xY0VIS3DNsLz/1GGlexaB/iSRmpi2jhF47EP6tgN9NG7D171vjJJG4 igMm7GVhhD/KlGfv9fOgX5bJAtlOwArG5Vo+Bmf+Ki17K0QE7Zd9VMyg3ZzyZpejJ2vW WefMlrNguLQMxbTTHXRoJjRqe+lTiDLfOUvvqEtQ2YebGI4Xo795OpV6WE+Au62p7luP RgDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=qDdLEFNf; 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 y8si2040215pji.65.2019.08.29.05.37.22; Thu, 29 Aug 2019 05:37:40 -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=merlin.20170209 header.b=qDdLEFNf; 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 S1727565AbfH2Me4 (ORCPT + 99 others); Thu, 29 Aug 2019 08:34:56 -0400 Received: from merlin.infradead.org ([205.233.59.134]:58050 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726950AbfH2Me4 (ORCPT ); Thu, 29 Aug 2019 08:34:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding: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=jyG+3RbyVo0ge5+B2Y+V/QY+BuDVjerDhPABGwRD/k8=; b=qDdLEFNf19MzqQplwE2CVjWaV YGbIsu6DDcp2lK4ohdBUKOh9yKReu33yIgqDpVz+AP6BzfUnpKO6zm8g9jzgGQ2GTsD/q6NmihmPZ TwjWvFOU8hqXpOrYVvYdhAP3eHV9rhAjwhSkG7cXnw2TpKVJRja02sE7nDy1WzZ37AOf4pkWRG/4C CFjjSC6/ZXgKKiWOzl5zkqcR03Xy22jH2gWVjtVx9BH60RnyWQzzSss/1eBh7A9Z4m4DOgko8FXZ7 DvRKd3oRsBAh6dKNU6U6uESHhzepPSD0KSzV0rbq6UMgFZV5D7x0fLe6dAMQiQOyP+inv9rNzhhiB DZ2LiKoZQ==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.92 #3 (Red Hat Linux)) id 1i3Jdd-0002SG-Od; Thu, 29 Aug 2019 12:34:53 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 755DB300825; Thu, 29 Aug 2019 14:34:16 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id B283B20C9570C; Thu, 29 Aug 2019 14:34:50 +0200 (CEST) Date: Thu, 29 Aug 2019 14:34:50 +0200 From: Peter Zijlstra To: Chuhong Yuan Cc: Ingo Molnar , linux-kernel@vger.kernel.org Subject: Re: [PATCH v4 6/8] sched: Replace strncmp with str_has_prefix Message-ID: <20190829123450.GP2332@hirez.programming.kicks-ass.net> References: <20190809071051.17387-1-hslester96@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190809071051.17387-1-hslester96@gmail.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Aug 09, 2019 at 03:10:51PM +0800, Chuhong Yuan wrote: > strncmp(str, const, len) is error-prone because len > is easy to have typo. I'm thinking that is exactly the easy case for compilers/semantic checkers to verify. Now granted, GCC doesn't seem to do that by itself, but still. I'd buy your argument if the prefix is variable, because in that case you can do prefix matching cheaper than strlen+strncmp, but as is, not really.