Received: by 2002:a25:86ce:0:0:0:0:0 with SMTP id y14csp915291ybm; Wed, 22 May 2019 13:52:16 -0700 (PDT) X-Google-Smtp-Source: APXvYqz0lTbxDlstr7qB8larik0TfYZY1WsRNZisEMm41NE+HRj4QrM1b9jk21Ls4icdIIfClohJ X-Received: by 2002:a62:7689:: with SMTP id r131mr98802765pfc.181.1558558335951; Wed, 22 May 2019 13:52:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558558335; cv=none; d=google.com; s=arc-20160816; b=O4tTSlXLRsw5VTddGo6BeXdNE2ocrN2yAFayWNKQEBxT2PV7m4bHd55qTUc4ktUxmX 78YOzFJpblOjGSCT2sESKXSGY70hdNiv3oRzASp1+R3DZesPXWNHUxkxp1ZwUX+6272e 3hfn0D2asCHaLH2eG5yzjx8/U0xl08MghQA0ig6vRx82LtTEs5btO0FrRUBQxellKgcJ XgxvH0sX77O0Wtgoqm4U+PtY5rpFGr54wFTaUcSop197l8Y1b6GDgnr9+gmKv0yFGy9Y +5t9CqonngnzDzyE4pqWpqSdfpjr7ng54yiez/mCdfkFQcaSC8rt1lRuxgOZCeupMpHt C3/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:organization:from:references:cc:to:subject; bh=VCseoTHH46kwZbXDY5hf3rsI4IGPytumhxSP831NyJ8=; b=qwcqjeP+dcCkQkjUquPlgLUuq86hWECyEk1+wHt9Az7GESs0GBcr+UeSdaB3sllF/6 FVzINZNr708HHCUiJmmZl/VJUa2YnwXrV9viHVTnDh13gzbLep8VvmPh1d1djpqkj0mC utvjbooGLovpd3HZWe9WFOBJlrcFwDZD/c5SfYsirPWL3oatb/kaYITRKgLkGdydHiHi B/yDUR+vFoQ7UxLeryWOXx1iC7buhyVNtLkr+j4KrQCpLXwUsNhWdFKCTxiHvhXeX+D4 7QZcfQe6lVAWSZdgGZKZM37m7/APH+smCh950i59u56sOPqtgdkeqQb0mQ5aBP1/AiMU ahcQ== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f38si1373863plb.339.2019.05.22.13.52.00; Wed, 22 May 2019 13:52:15 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730151AbfEVUun (ORCPT + 99 others); Wed, 22 May 2019 16:50:43 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58124 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729848AbfEVUum (ORCPT ); Wed, 22 May 2019 16:50:42 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5CA2D307D963; Wed, 22 May 2019 20:50:36 +0000 (UTC) Received: from llong.remote.csb (dhcp-17-85.bos.redhat.com [10.18.17.85]) by smtp.corp.redhat.com (Postfix) with ESMTP id 51AB5648B3; Wed, 22 May 2019 20:50:31 +0000 (UTC) Subject: Re: [PATCH] locking/lock_events: Use this_cpu_add() when necessary To: Linus Torvalds Cc: Peter Zijlstra , Ingo Molnar , Will Deacon , Thomas Gleixner , Borislav Petkov , "H. Peter Anvin" , Linux List Kernel Mailing , the arch/x86 maintainers , Davidlohr Bueso , Tim Chen , huang ying References: <20190522153953.30341-1-longman@redhat.com> From: Waiman Long Organization: Red Hat Message-ID: <65f36604-898d-2649-5a41-078ccdc08dc4@redhat.com> Date: Wed, 22 May 2019 16:50:30 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Content-Language: en-US X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Wed, 22 May 2019 20:50:42 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 5/22/19 3:54 PM, Linus Torvalds wrote: > On Wed, May 22, 2019 at 8:40 AM Waiman Long wrote: >> +#if defined(CONFIG_PREEMPT) && \ >> + (defined(CONFIG_DEBUG_PREEMPT) || !defined(CONFIG_X86)) >> +#define lockevent_percpu_inc(x) this_cpu_inc(x) >> +#define lockevent_percpu_add(x, v) this_cpu_add(x, v) > Why that CONFIG_X86 special case? > > On x86, the regular non-underscore versionm is perfectly fine, and the > underscore is no faster or simpler. The condition is to use non-underscore version only when 1) It is a preempt kernel; AND 2) It either have CONFIG_DEBUG_PREEMPT on, OR it is a non-x86 system. > So just make it be > > #if defined(CONFIG_PREEMPT) > .. non-underscore versions.. > #else > .. underscore versions .. > #endif > > and realize that x86 simply doesn't _care_. On x86, it will be one > single instruction regardless. > > Non-x86 may prefer the underscore versions for the non-preempt case. I was thinking of doing that originally, but then change it so x86 preempt kernel will also use the underscore version as long as CONFIG_DEBUG_PREEMPT is not set. I can change it back if that makes it less confusing. Cheers, Longman