Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2776828yba; Mon, 22 Apr 2019 12:46:07 -0700 (PDT) X-Google-Smtp-Source: APXvYqxmRaDQSjEuRWozlKSyT4JU0GDiRq8wuQl7qlVC7qj6zy77IzU2LNnVdzT4FWDJiDDDobxo X-Received: by 2002:a17:902:2:: with SMTP id 2mr22210075pla.61.1555962367731; Mon, 22 Apr 2019 12:46:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555962367; cv=none; d=google.com; s=arc-20160816; b=QnDW+ibPwV7GBnXd8QHiSYw/umVNcWj8g8bGeB3T3V3qs89uu8J8p0DGYre8qt6NeO 0nqlDbsR3elNp6ZyrCIG286k4jgGrZF511aDvbBAHGgNBBSEZopFSSP3Qla33HmvRLk6 jFKmKiA7fN/5QcaukmB8+6fbBW9dWo3UnRKHzIc427brMsxMBwZvo3LO0AHRbVH7pER1 OiIEJiWNwM0Ngjg9pZHA+vbjnzGQWMPb8Ii1F1f/X+9/BDyqNCYDmQOSif+vSg6j/tCL DxD4Jcgm/B9JQZZGopcmZ0LQ4x8VMkjJWbDZO5RbuxaXlwSyLG1uaLdpGJoCzpyZ1FcA Fhyw== 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=be6f2f0XIlqFU7RHgEDNHdFLaZKAoDs5ON2xf3GreVs=; b=wA8+BcYTMb1fAns5VG/SUXFvgsbpyXu8qNf34BRzlOQ10NDx/Knmj8PWLF4zW+D4Y0 I8eWTy5+8yDz4PEwZDu1Jg3uDjcFxKfh8Fc+67L9XJF6nyG3pfOrpg/nOXf5FOG8vuVE K4coOGKDdUH8fDWYMvLe0xBCqu6ai2jtZzX3wCkxr0VeL94wxUx0QdN/odFHmOD3ReYF 8qtL5CM9zhR71wZqwvQ3DQsMkWD0RAbQW1iMefJ7SHmtI7mNqKck6ys8iTtL867bbuN9 d/GXYc6gnP2mLcNdb3uWkLiuVp1mcJNrKq8whtxm4hfgt5NckeojPBRr2faCkMmuES9K w41g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=MZnMJSvs; 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 g1si12792556pgq.268.2019.04.22.12.45.52; Mon, 22 Apr 2019 12:46:07 -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=MZnMJSvs; 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 S1729514AbfDVToe (ORCPT + 99 others); Mon, 22 Apr 2019 15:44:34 -0400 Received: from mail-oi1-f194.google.com ([209.85.167.194]:36563 "EHLO mail-oi1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729490AbfDVTod (ORCPT ); Mon, 22 Apr 2019 15:44:33 -0400 Received: by mail-oi1-f194.google.com with SMTP id l203so9384578oia.3 for ; Mon, 22 Apr 2019 12:44:32 -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=be6f2f0XIlqFU7RHgEDNHdFLaZKAoDs5ON2xf3GreVs=; b=MZnMJSvszGOJ69yW2f92BRR2//4YgYRkKKac5Gqy7Awh1bsWzu6rOOSWtZwJtx/tcG eDw1eDkllfmunatVZlfYdB6E/H0sEhYx56nkD9/3BTyiQhK1cK3ohxtnncyN808QU9Ip EHjb1faIflXV5qJO4U85TcW+zBgo6JUqMcJpYrNghYuo1YIWP/jnyZ0my2UTfw52gR0p 0x1xVJYtgpLLMZiiVV2/R/giaXcjlq2VvA7Z8shcCNAngnJ6VI6G+ScfLPtwzKJEy1HA MzWZ1/YUvj5/eXdhJA+Ieta7O8ADe/tnz1YT0d9DikYe3aJrHMlfOTBTM/lY7uViDVxI lLQQ== 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=be6f2f0XIlqFU7RHgEDNHdFLaZKAoDs5ON2xf3GreVs=; b=US69COW6vqv2Cy46nWjkDNro3aLKp7XxYwRHKu+cEI9oTA2phqEVQw+qKou225dDbl sdWf1hK9y7opQlPe+SvvQCjW0ktOgtqYq/jDq3Um8mDl/RzMxxXZhPyuZraON11CQ5ei aSXPxOIZqtNxqj5Bv3vH5uZSIzRDQX5CXnfrAPf0cRNOXU2q3DA5HaofEYOdjb0Ui2LK Jr21KwS//Z32iLU+N0zy6VwXckiuDzm3iJJQpvW4IiA/AGxA+S0X+/Htt3UXQYI7OAhW mMS6WjvPcDzCBOop2Qjx6gPns3oWfFv5XgONc5cVIYmzNbdy0QVGeAlsRlaVv5jJZJuP yG9w== X-Gm-Message-State: APjAAAUwWaWdoW/ng/1SYfl7BAz3M+/sM7GH6FgnDuy5pEtG4ka1hyMA bhQkbEsrcoRR8+8WMj5KDXaDQZgmDhHGmhUn21V4GQ== X-Received: by 2002:aca:f581:: with SMTP id t123mr11818692oih.0.1555962272101; Mon, 22 Apr 2019 12:44:32 -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: From: Dan Williams Date: Mon, 22 Apr 2019 12:44:21 -0700 Message-ID: Subject: Re: [PATCH v5 1/6] libnvdimm: nd_region flush callback support To: Jeff Moyer Cc: Christoph Hellwig , 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 Mon, Apr 22, 2019 at 8:59 AM Jeff Moyer wrote: > > Dan Williams writes: > > > 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 don't think nvdimm_flush is a hot path. Numbers of some > representative workload would prove one of us right. I'd rather say that the if "if (!op) do_generic()" pattern is more readable in the general case, saves grepping for who set the op in the common case. The fact that it has the potential to be faster is gravy at that point.