Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp848023ybe; Wed, 4 Sep 2019 08:37:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqxuLacP8+sVpO72/lZW3AZCmSBR+fwmNTnMDj/DqoIHkFcQtPiGRUAPJrkw3CirsZ1Qpf+G X-Received: by 2002:a17:902:5e1:: with SMTP id f88mr11977941plf.1.1567611448964; Wed, 04 Sep 2019 08:37:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567611448; cv=none; d=google.com; s=arc-20160816; b=Cfgxg1dMyU//sLhIjKwc75IistXIOvEaGVd51CpIzI7ZcOFjjkqGtGwLyCUc3aburc YsbnrCUqk0hAOcGwvOaVeHe1rbhxY3rvVh6djfk+NtENAiMP2uJfr69TmxgXf5XyjTUz WXuRu1UtqJRi4SQqOrJqHT/o07IyP7g7LPZtXSheUXnm+NB/PZvlq4iD8UT/asGLt0UO Tihxr6t6elkFG5egJ5BPzBk7y/3WHxcn43gZCqdJ9Nt+tJEUdt0UFo6roRPg0KcAxa/h jpXU/6XmuxfbM4F21pQU46ekjlBGuYO/jmozRu4ni0NMBWaNmo2hqPImWrhXpFNlEowd jtPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date; bh=X15XoCenHejHG15vRroZG53c8w73O15LxduLKJCIB4s=; b=MRusgm44rzblDMWD/HKz1Ep072n87Yd9Kgn6vDGDzWyqfJPR4AMAsZFsOX54F3SSfe siNrhx3Q+z43wOzqogfoCqboMfAk/YhPKvBLg1QSmSwrDa1NbABDqwOT7dopgD/jVd2N eTCTQYpTIqIvFlrn09dLHsKap5qMpLhA1BbKzMyJiOjYveXTCs1ARAQiALNe3xm+jqPg 3SIW6yQaWjS69po2PQXgj1bV6kW+K0jpggJG2DGnBU6fS+jhxPn7d6PBOzsa6TJp83dy WmMzGHiIHRhI+Lmlb9lNPhho6sCrtf/uw+iqofN2UpOanw0dNffucSAUYFqwwPiqgFv8 w/iQ== 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 j5si2637400pjf.60.2019.09.04.08.37.12; Wed, 04 Sep 2019 08:37:28 -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 S1731246AbfIDPgR (ORCPT + 99 others); Wed, 4 Sep 2019 11:36:17 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36262 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730428AbfIDPgR (ORCPT ); Wed, 4 Sep 2019 11:36:17 -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 D166E3B58C; Wed, 4 Sep 2019 15:36:16 +0000 (UTC) Received: from file01.intranet.prod.int.rdu2.redhat.com (file01.intranet.prod.int.rdu2.redhat.com [10.11.5.7]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 62C5B60606; Wed, 4 Sep 2019 15:36:11 +0000 (UTC) Received: from file01.intranet.prod.int.rdu2.redhat.com (localhost [127.0.0.1]) by file01.intranet.prod.int.rdu2.redhat.com (8.14.4/8.14.4) with ESMTP id x84FaA0n019063; Wed, 4 Sep 2019 11:36:10 -0400 Received: from localhost (mpatocka@localhost) by file01.intranet.prod.int.rdu2.redhat.com (8.14.4/8.14.4/Submit) with ESMTP id x84FaAY3019059; Wed, 4 Sep 2019 11:36:10 -0400 X-Authentication-Warning: file01.intranet.prod.int.rdu2.redhat.com: mpatocka owned process doing -bs Date: Wed, 4 Sep 2019 11:36:10 -0400 (EDT) From: Mikulas Patocka X-X-Sender: mpatocka@file01.intranet.prod.int.rdu2.redhat.com To: Huaisheng HS1 Ye cc: "snitzer@redhat.com" , "agk@redhat.com" , "prarit@redhat.com" , Tzu ting Yu1 , "dm-devel@redhat.com" , "linux-kernel@vger.kernel.org" , Huaisheng Ye Subject: RE: [External] Re: [PATCH] dm writecache: skip writecache_wait for pmem mode In-Reply-To: Message-ID: References: <20190902100450.10600-1-yehs2007@zoho.com> User-Agent: Alpine 2.02 (LRH 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII 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.38]); Wed, 04 Sep 2019 15:36:16 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 4 Sep 2019, Huaisheng HS1 Ye wrote: > > -----Original Message----- > > From: Mikulas Patocka > > Sent: Wednesday, September 4, 2019 4:49 PM > > On Mon, 2 Sep 2019, Huaisheng Ye wrote: > > > > > From: Huaisheng Ye > > > > > > The array bio_in_progress[2] only have chance to be increased and > > > decreased with ssd mode. For pmem mode, they are not involved at all. > > > So skip writecache_wait_for_ios in writecache_flush for pmem. > > > > > > Suggested-by: Doris Yu > > > Signed-off-by: Huaisheng Ye > > > --- > > > drivers/md/dm-writecache.c | 3 ++- > > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > > > diff --git a/drivers/md/dm-writecache.c b/drivers/md/dm-writecache.c > > > index c481947..d06b8aa 100644 > > > --- a/drivers/md/dm-writecache.c > > > +++ b/drivers/md/dm-writecache.c > > > @@ -726,7 +726,8 @@ static void writecache_flush(struct dm_writecache *wc) > > > } > > > writecache_commit_flushed(wc); > > > > > > - writecache_wait_for_ios(wc, WRITE); > > > + if (!WC_MODE_PMEM(wc)) > > > + writecache_wait_for_ios(wc, WRITE); > > > > > > wc->seq_count++; > > > pmem_assign(sb(wc)->seq_count, cpu_to_le64(wc->seq_count)); > > > -- > > > 1.8.3.1 > > > > I think this is not needed - wait_event in writecache_wait_for_ios exits > > immediatelly if the condition is true. > > > > This code path is not so hot that we would need microoptimizations like this to > > avoid function calls. > > Hi Mikulas, > > Thanks for your reply, I see what you mean, but I can't agree with you. > > For pmem mode, this code path (writecache_flush) is much more hot than > SSD mode. Because in the code, the AUTOCOMMIT_BLOCKS_PMEM has been > defined to 64, which means if more than 64 blocks have been inserted to > cache device, also called uncommitted, writecache_flush would be called. > Otherwise, there is a timer callback function will be called every 1000 > milliseconds. > > #define AUTOCOMMIT_BLOCKS_SSD 65536 > #define AUTOCOMMIT_BLOCKS_PMEM 64 > #define AUTOCOMMIT_MSEC 1000 > > So when dm-writecache running in working mode, there are continuous > WRITE operations has been mapped to writecache_map, writecache_flush > will be used much more often than SSD mode. > > Cheers, > Huaisheng Ye So, you save one instruction cache line for every 64*4096 bytes written to persistent memory. If you insist on it, I can acknowledge it, but I think it is really an over-optimization. Acked-By: Mikulas Patocka Mikulas