From patchwork Fri Jul 28 14:42:24 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josef Bacik X-Patchwork-Id: 9871179 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 30AB06038F for ; Mon, 31 Jul 2017 07:41:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 23EFE285B6 for ; Mon, 31 Jul 2017 07:41:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 18BB3285C4; Mon, 31 Jul 2017 07:41:23 +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 43777285B6 for ; Mon, 31 Jul 2017 07:41:21 +0000 (UTC) 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 1FCB6C1CE64B; Mon, 31 Jul 2017 07:41:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 1FCB6C1CE64B Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=toxicpanda.com Authentication-Results: ext-mx07.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 1FCB6C1CE64B 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="yArcsOxR" 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 5A9778AD60; Mon, 31 Jul 2017 07:41:19 +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 3A04D180B467; Mon, 31 Jul 2017 07:41:16 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v6SEgWmh022199 for ; Fri, 28 Jul 2017 10:42:32 -0400 Received: by smtp.corp.redhat.com (Postfix) id 9043A6F44A; Fri, 28 Jul 2017 14:42:32 +0000 (UTC) Delivered-To: dm-devel@redhat.com Received: from mx1.redhat.com (ext-mx09.extmail.prod.ext.phx2.redhat.com [10.5.110.38]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 89D29600C2 for ; Fri, 28 Jul 2017 14:42:29 +0000 (UTC) Received: from mail-qk0-f195.google.com (mail-qk0-f195.google.com [209.85.220.195]) (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 89CEDF618A for ; Fri, 28 Jul 2017 14:42:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 89CEDF618A Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=toxicpanda.com Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=none smtp.mailfrom=josef@toxicpanda.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 89CEDF618A Received: by mail-qk0-f195.google.com with SMTP id q66so21233592qki.1 for ; Fri, 28 Jul 2017 07:42:27 -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=yArcsOxRiozm2bcG00LGVtiYRItI/5/4KU4TMq8BBAEc/hrmVLIWBmlE7EcSGnm7D4 +86r+heFfodAVurOd5OZQIPXFVy322upHWnquXt9JmLyXhBp+4i5H7dfq9X67YNWtmIX /HniJ6Y0He7wImu+k0fSWjPjbRpUWD56j3SlBy4D/S7ZOlpl2EXQQetD1Vv61l5hhdo0 Y4VR6ueL5wqcQ0yCLrjG6ymTU4KelJ1IuxuBK3K8Rc7RAV5n4u12/pLwj2VSLKzxz2NP kk2uD12Bj+ajKwORHKYpLPhf2l8IFGpFwjGlBZg731XcZfqO84Xkk5+QYRq8FKlOTE5J s0Pw== 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=tUNjbK3cYRz6NMgCWnKwbOmszSGjYJdtAw0x9vCWML2q2cS6bCY2/IZSgJYvQ1TLNP e3E04u1iNOiyMUoHk39NELWJDXPwsOEQe1uhFg08GQOx9WYNINN7tkxL68r3ObV9L3ga kXjAFerRbj5nYHDCgvjD6bkRq68CaxvZ6PU+p1R6M2ZhyvnX1P8D6caT8EEiO0YJcTKZ EgKQ0Gq8b1lisRMEPZzaU+g+wBxMIPgIN72Fg9dTnoxp3mq16/tIWy55jc9OOIyVIoWh x0R+MWESm2pqDPS0ngEf48OMKIXGAqE0K0jfJO7H0Lmc9wphTD/gQzXCF9BNb7RWHdOi nBsw== X-Gm-Message-State: AIVw112BnMN0gdLJoYMsRWORzDv9DjWAzcw3bIickE+I8X6DYAPq/PUx e1CH79g5vqLJoI8lIWo= X-Received: by 10.55.43.144 with SMTP id r16mr10252348qkr.59.1501252946872; Fri, 28 Jul 2017 07:42:26 -0700 (PDT) Received: from localhost ([2606:a000:4381:1201:225:22ff:feb3:e51a]) by smtp.gmail.com with ESMTPSA id l31sm16422332qtc.64.2017.07.28.07.42.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 28 Jul 2017 07:42:26 -0700 (PDT) From: josef@toxicpanda.com X-Google-Original-From: jbacik@fb.com To: kernel-team@fb.com, dm-devel@redhat.com Date: Fri, 28 Jul 2017 10:42:24 -0400 Message-Id: <1501252945-20615-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.38]); Fri, 28 Jul 2017 14:42:27 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Fri, 28 Jul 2017 14:42:27 +0000 (UTC) for IP:'209.85.220.195' DOMAIN:'mail-qk0-f195.google.com' HELO:'mail-qk0-f195.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.220.195 mail-qk0-f195.google.com 209.85.220.195 mail-qk0-f195.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.38 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: dm-devel@redhat.com X-Mailman-Approved-At: Mon, 31 Jul 2017 03:41:14 -0400 Cc: Josef Bacik Subject: [dm-devel] [PATCH 1/2] 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.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Mon, 31 Jul 2017 07:41:21 +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); }