From patchwork Thu Sep 7 15:02:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josef Bacik X-Patchwork-Id: 9942427 X-Patchwork-Delegate: snitzer@redhat.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 54ADB600CB for ; Thu, 7 Sep 2017 15:28:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5F0A02871E for ; Thu, 7 Sep 2017 15:28:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5288728722; Thu, 7 Sep 2017 15:28:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D44452871E for ; Thu, 7 Sep 2017 15:28:49 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EF71B5F739; Thu, 7 Sep 2017 15:28:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com EF71B5F739 Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=toxicpanda.com Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=dm-devel-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com EF71B5F739 Authentication-Results: mx1.redhat.com; dkim=fail reason="signature verification failed" (2048-bit key) header.d=toxicpanda-com.20150623.gappssmtp.com header.i=@toxicpanda-com.20150623.gappssmtp.com header.b="Lvxys0dq" Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B51B95D972; Thu, 7 Sep 2017 15:28:46 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 2A7DC1806108; Thu, 7 Sep 2017 15:28:45 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v87F38tb024265 for ; Thu, 7 Sep 2017 11:03:08 -0400 Received: by smtp.corp.redhat.com (Postfix) id 7F24F68240; Thu, 7 Sep 2017 15:03:08 +0000 (UTC) Delivered-To: dm-devel@redhat.com Received: from mx1.redhat.com (ext-mx04.extmail.prod.ext.phx2.redhat.com [10.5.110.28]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7A62668247 for ; Thu, 7 Sep 2017 15:03:06 +0000 (UTC) Received: from mail-qt0-f193.google.com (mail-qt0-f193.google.com [209.85.216.193]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 028DC85542 for ; Thu, 7 Sep 2017 15:03:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 028DC85542 Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=toxicpanda.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=none smtp.mailfrom=josef@toxicpanda.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 028DC85542 Received: by mail-qt0-f193.google.com with SMTP id h21so5753456qth.4 for ; Thu, 07 Sep 2017 08:03:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=toxicpanda-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=ETk4ZjjYWj2di5VT/K7bTWcn2ouhaiBBPb1Wzq9upOE=; b=Lvxys0dqMIL87gcVFND6buyyBcs8FOkSMUwQPwnOzLVw/+ugpUJTJhz7nqganyeOGr +rcAL3yAzuWhA1AxHO7xvuf0zxro4xshkPhovCOJumbjYBc+XLktEjtg5J2BX2B7kyjh A1ds1F4ddh+C+ODTTZz/cOmwhjr2mg0znOv6vhDc5fSw0ZE0eGNgovElGMKiza/BCk3Z fcfsUOCZocH93FEut/hLlRya5TR71R12XwPtP3Imx5yo10K6rOywvHkJo9b5UP2kMgTj GZh9ug919jjpDRmJVnGDwDbADqrI8UmEfvdXgnwkrRkDWZ9Szxc4OPEfh8BDVDf1+YWn r74g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=ETk4ZjjYWj2di5VT/K7bTWcn2ouhaiBBPb1Wzq9upOE=; b=cjNpnJ6dL4NGpnWpOvVSjm9JmmgTHsmuX2/QyOWfTBvFFGTEb9uSsNm4Lv6oScVd6/ 5a2p0Wn4y2UrlOjnr/zvL7CPz+3i904uWPGwfIe5OOEvohqzO92gNYf6ts49+HRaXHN3 GE3hCztEf0a9FSaNjZ8k9u7gOjOpVx9hpRA1rPig/VPviZivAG9xzr+hj5CKTl8y+WMl JAwfXq5eDQSsRuWHifm6WFk3FyNQK888a5DkIVmIhs+v4EZg5OLrdy0hARwsWfcI0Rkz FnSwtSgnniIpE+8R/yR/yD+0Uk3Ku5nMRiXTJpYENUkomK45gj1UQAUauDw85vN8ftj8 Yfmg== X-Gm-Message-State: AHPjjUhZjkrmt+GNWic+WFoKfrvOVLY/oAB1i02xgD3Yp2v1rAyTkZFm pHVmyohB7wC/4MSOCXLkuA== X-Google-Smtp-Source: AOwi7QAWwI18/Zm3ke6fpJAMzzcefcJH4DCv08wpicfrH4bReS4Hs3XlKb146Wq8dnq0HRuksbMC6g== X-Received: by 10.200.10.12 with SMTP id b12mr4137931qti.152.1504796581989; Thu, 07 Sep 2017 08:03:01 -0700 (PDT) Received: from localhost ([2606:a000:4381:1201:225:22ff:feb3:e51a]) by smtp.gmail.com with ESMTPSA id c38sm1757234qtc.18.2017.09.07.08.03.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 Sep 2017 08:03:01 -0700 (PDT) From: josef@toxicpanda.com X-Google-Original-From: jbacik@fb.com To: dm-devel@redhat.com, snitzer@redhat.com, amir73il@gmail.com Date: Thu, 7 Sep 2017 11:02:59 -0400 Message-Id: <1504796580-18069-1-git-send-email-jbacik@fb.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Thu, 07 Sep 2017 15:03:03 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Thu, 07 Sep 2017 15:03:03 +0000 (UTC) for IP:'209.85.216.193' DOMAIN:'mail-qt0-f193.google.com' HELO:'mail-qt0-f193.google.com' FROM:'josef@toxicpanda.com' RCPT:'' X-RedHat-Spam-Score: 0.47 (DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, RCVD_IN_SORBS_SPAM) 209.85.216.193 mail-qt0-f193.google.com 209.85.216.193 mail-qt0-f193.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.28 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: dm-devel@redhat.com Cc: Josef Bacik Subject: [dm-devel] [PATCH 1/2][RESEND] dm-log-writes: don't use all the cpu X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Thu, 07 Sep 2017 15:28:48 +0000 (UTC) X-Virus-Scanned: ClamAV using ClamSMTP From: Josef Bacik The check to see if the logging kthread needs to go to sleep is wrong, it checks lc->pending_blocks, which will be non-0 if there are any blocks that are pending, whether they are ready to be logged or not. What we really want is to go to sleep until it's time to log blocks, so change this check so we do actually go to sleep in between flushes. Signed-off-by: Josef Bacik --- drivers/md/dm-log-writes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/md/dm-log-writes.c b/drivers/md/dm-log-writes.c index a1da0eb..9aab510 100644 --- a/drivers/md/dm-log-writes.c +++ b/drivers/md/dm-log-writes.c @@ -399,7 +399,7 @@ static int log_writes_kthread(void *arg) if (!try_to_freeze()) { set_current_state(TASK_INTERRUPTIBLE); if (!kthread_should_stop() && - !atomic_read(&lc->pending_blocks)) + list_empty(&lc->logging_blocks)) schedule(); __set_current_state(TASK_RUNNING); }