Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp891345yba; Thu, 18 Apr 2019 11:17:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqxiK10nQWq4xRXGlAYxvKOsp2Y4cSKLP3InviTk57RZYgtLB7baXblPxM3hCbDASoZZW9ld X-Received: by 2002:aa7:82d6:: with SMTP id f22mr97490566pfn.190.1555611463672; Thu, 18 Apr 2019 11:17:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555611463; cv=none; d=google.com; s=arc-20160816; b=wsLHhMm8bE9cRZJEt6qDZxBRJ1uwKcLfd9qH6d7E0zGnkQ19Pa2TqEHMmVchSImbJZ TgNcBwPNFnJL7Qt9kRV29cWsmxsV8gjDRaOBikL0bHCTYZONSM7hLZL6EuPlFqCec3iK 38CWjkO10FBgZsicz1mpKj58tgXGjl2JAj4euLGCTt5Itu0Ms/iKzWQ3611/ojfthv3y GuTioeAF27o0EjcZEaQ2Yfh+q13CTQ2zmuvaqhJfEcZcSpdn8VShJts+JCmX3VlB88j8 6jtyufcMcL3DKojdNKqm/ewp3qwPvBrsAoBTvR3f0Nl7kfKtB13iyPQHZozTvXNcVDOj eQQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=cNvcYTnY3+vvHUTxTkoLoLivaNOP88tmLELkxGdG9NU=; b=b3e3ameq4SgESalnzxsdvXbWzi/BarwJhKYD3AylZ32JNfGOoL7zZmKWkuUK3arVxM jA46jiMARsgrWnT75bIOheirEy5pBW6c7cPQeM75Sj9C9iTsPiAvsVozr7hLqrnQi3A1 idIgGAz5Ex3lvzuIyIS0Bxe2kmHx8ACU3KHjStkY2m0QfqoBcT1QosQ8+kOg83NSyoAF UY22SEsD6Pxjb7oy/+ZPrxlg3iJVLAPQa2SnnvAUUiONA6OshBlmPU4oG/46pJdkPIX9 WBwV1ccvit8EZa9u8dwOvjkv/+bd+ngWra5tB0+inT+U4K5RbDRR7FSNdsjwRTRyf8Ng sawg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=ktsdaFbH; 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=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l11si2815879plb.370.2019.04.18.11.17.29; Thu, 18 Apr 2019 11:17:43 -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=pass header.i=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=ktsdaFbH; 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2392137AbfDRSPS (ORCPT + 99 others); Thu, 18 Apr 2019 14:15:18 -0400 Received: from mail-ot1-f68.google.com ([209.85.210.68]:45696 "EHLO mail-ot1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391950AbfDRSPM (ORCPT ); Thu, 18 Apr 2019 14:15:12 -0400 Received: by mail-ot1-f68.google.com with SMTP id e5so2448512otk.12 for ; Thu, 18 Apr 2019 11:15:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=cNvcYTnY3+vvHUTxTkoLoLivaNOP88tmLELkxGdG9NU=; b=ktsdaFbHHTTd3R9uOez0tgfH91piu1Xl5DlUQg9AdDFLkPBDJI5BaCJt8wdik0yC9L dH1VUAIEKpMOG3eMgmYm1jbHjjxODglk6p70vY9qXowThleT7Q0gQUDAJS9MA3j7Y9lF v8ZxpajT9Rk0mPmn47Onvt24QMYIumY0g4+EJAIXZlXQcKxDlrzTO/b2iH+eG5vkZQVH ouopY1EtaMEeFiq04GySGtlZKge2N6IsV7o1pM7Je/rREB1BqCRPzbORKPO8w/0MElm/ Opf6d01RSEY9uEf/J9C9GZzgTb2wZrkTq4GMtT+Dl+3EhN2pMqMJwWjbjUxgrKq+DhMm CmXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=cNvcYTnY3+vvHUTxTkoLoLivaNOP88tmLELkxGdG9NU=; b=Iref8mMcd4Aon2Eskos0qLmkR426ctdkG0McEcqUTMnOYHsKQ3z/fTBTKrsJs33P6I 5hpyWMLcu1aQDAYPfDMaQRWqTAYEQolIiDFJf26yFr8XiAPObJqgQ0mPaXOs7X/S8qRX VaS45Nw+ZCAvEdna/EwWyKQVMclBE3qd+kih+6eaIRgVB7kCRnrRsILQGL78JE3/b9Qh 0k2T2Px1AEtPhNoR74awI2oSIOa3wvH+mChPIg+rZjy+Y8Hx7wJK+OaOtX8QzGuKQL8l CntB2EcIu1casmnIsGKVtJaqO+YlQLkwo1PncLMhPUh+wiK3eEkQjj3vbiIpXDQCVGG+ PEQw== X-Gm-Message-State: APjAAAXC/W+oVZJrM5jFGHzB4bt36uImben0fOYUTpm5eE2sZvIPiA6Q RR0DZtICnAvujGspHYTE3g8zdPhs/3iyu6Qr/SqLmQ== X-Received: by 2002:a05:6830:15d4:: with SMTP id j20mr4679415otr.367.1555611312059; Thu, 18 Apr 2019 11:15:12 -0700 (PDT) MIME-Version: 1.0 References: <20190410040826.24371-1-pagupta@redhat.com> <20190410040826.24371-2-pagupta@redhat.com> <20190412083230.GA29850@quack2.suse.cz> <20190418161833.GA22970@infradead.org> In-Reply-To: <20190418161833.GA22970@infradead.org> From: Dan Williams Date: Thu, 18 Apr 2019 11:14:59 -0700 Message-ID: Subject: Re: [PATCH v5 1/6] libnvdimm: nd_region flush callback support To: Christoph Hellwig Cc: Jeff Moyer , Jan Kara , Pankaj Gupta , linux-nvdimm , Linux Kernel Mailing List , virtualization@lists.linux-foundation.org, KVM list , linux-fsdevel , Linux ACPI , Qemu Developers , linux-ext4 , linux-xfs , Ross Zwisler , Vishal L Verma , Dave Jiang , "Michael S. Tsirkin" , Jason Wang , Matthew Wilcox , "Rafael J. Wysocki" , Len Brown , "Theodore Ts'o" , Andreas Dilger , "Darrick J. Wong" , lcapitulino@redhat.com, Kevin Wolf , Igor Mammedov , Nitesh Narayan Lal , Rik van Riel , Stefan Hajnoczi , Andrea Arcangeli , David Hildenbrand , david , cohuck@redhat.com, Xiao Guangrong , Paolo Bonzini , kilobyte@angband.pl, yuval shaia Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 18, 2019 at 9:18 AM Christoph Hellwig wrote: > > On Thu, Apr 18, 2019 at 09:05:05AM -0700, Dan Williams wrote: > > > > I'd either add a comment about avoiding retpoline overhead here or just > > > > make ->flush == NULL mean generic_nvdimm_flush(). Just so that people don't > > > > get confused by the code. > > > > > > Isn't this premature optimization? I really don't like adding things > > > like this without some numbers to show it's worth it. > > > > I don't think it's premature given this optimization technique is > > already being deployed elsewhere, see: > > > > https://lwn.net/Articles/774347/ > > For one this one was backed by numbers, and second after feedback > from Linux we switched to the NULL pointer check instead. Ok I should have noticed the switch to NULL pointer check. However, the question still stands do we want everyone to run numbers to justify this optimization, or make it a new common kernel coding practice to do: if (!object->op) generic_op(object); else object->op(object); ...in hot paths? I agree with not doing premature optimization in principle, but this hack is minimally intrusive from a readability perspective similar to likely()/unlikely() usage which also don't come with numbers on a per patch basis.