From patchwork Tue Jul 31 16:39:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josef Bacik X-Patchwork-Id: 10551055 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9D1DC13B8 for ; Tue, 31 Jul 2018 16:39:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8DD992AFF1 for ; Tue, 31 Jul 2018 16:39:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 81F0C2B020; Tue, 31 Jul 2018 16:39:11 +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=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2988C2AFF1 for ; Tue, 31 Jul 2018 16:39:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727307AbeGaSUR (ORCPT ); Tue, 31 Jul 2018 14:20:17 -0400 Received: from mail-qk0-f196.google.com ([209.85.220.196]:46717 "EHLO mail-qk0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727135AbeGaSUR (ORCPT ); Tue, 31 Jul 2018 14:20:17 -0400 Received: by mail-qk0-f196.google.com with SMTP id 191-v6so4715466qki.13 for ; Tue, 31 Jul 2018 09:39:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=toxicpanda-com.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id:in-reply-to:references; bh=93Lzbb71Um9iy7cvpnPL2/U5gIkaopYVhymW2QhiPoo=; b=iV7hQoJXM068QAvPa7NILMB+rjTwTgP2RTkN3aCmX7KMvL1cizBr0MNrVeKqk119dV ry24CbWAd2cTMMr+6yyT0bPgcQZmUWM45Nuq2GkQPyR3Y2lcI1292RhLgSCzGOkjGG9I lrk3sC45cNtDrPb6KUdAvjqeSIBek0WasL9acC+ONNAu3f6KGSVxuL4a+OyqP/pE6C+Q YeeyR0Bw1sF2sNDWNor9RlQUpmIgNNsjcjQlYyIVO1bi35B96y049pJ/OnPYdtq404Na gG6E/R67qoKd6gqTdm1x7Jkil/e7mFGaqfOrO+Uwwan62JIzEStWA4VwYxU07Qjbuojx R7eA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=93Lzbb71Um9iy7cvpnPL2/U5gIkaopYVhymW2QhiPoo=; b=JzAk76neg2GIyVeDKsFjf3YSVxgtJ4KbOVZDZF3n5eyuGB8MG3K77S+ZxoL14Nt+ma iEMFDJ/yT1XemGD+4ZDcaB1hRDvlFVYXaKo49Ierrs51ytzQgUA789Ko7hH98ndwUgYv im84/Vszgrpzzely2fDyM67Wz9Tm4TXv1Ww7fNTeGtngiapb+71tUhldF9ZOPrvlJC89 Il6Ma07grOV4M91uUD1m21uN9I+5cnzjb8U334EqmFOz1UPjA8DRRHgpdd+YwQHtwUJp eNevU9l07oEUhHn6idYtq81jZZoe4AX/X+erIWZFL1FMYSooDZIpo7mO04gA1ivu5hIq SIfA== X-Gm-Message-State: AOUpUlHUlsvOMmKWwm8NL0LZIBEsxV5biHy7L4zihl9jC69O9PEVcsYx KiLTkjzHT0ilxjefwUTkLgDlo4btKzw= X-Google-Smtp-Source: AAOMgpelGz/oXeINH0lyN3fhGJzqzwMHSiYoEFsDgwan1bj9QKsctpeht8T8e0WajlgjH0g/xtt4Yg== X-Received: by 2002:a37:c249:: with SMTP id j9-v6mr20868506qkm.157.1533055149114; Tue, 31 Jul 2018 09:39:09 -0700 (PDT) Received: from localhost ([107.15.81.208]) by smtp.gmail.com with ESMTPSA id o29-v6sm16300513qkh.85.2018.07.31.09.39.08 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 31 Jul 2018 09:39:08 -0700 (PDT) From: Josef Bacik To: axboe@kernel.dk, linux-block@vger.kernel.org, kernel-team@fb.com Subject: [PATCH 1/3] blk-iolatency: fix blkg leak in timer_fn Date: Tue, 31 Jul 2018 12:39:02 -0400 Message-Id: <20180731163904.21856-2-josef@toxicpanda.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180731163904.21856-1-josef@toxicpanda.com> References: <20180731163904.21856-1-josef@toxicpanda.com> Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP At this point we have a ref on the blkg, we need to drop it if we don't have a iolat. Signed-off-by: Josef Bacik --- block/blk-iolatency.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/blk-iolatency.c b/block/blk-iolatency.c index bb59b2929e0d..b0dc4fc64b3e 100644 --- a/block/blk-iolatency.c +++ b/block/blk-iolatency.c @@ -627,7 +627,7 @@ static void blkiolatency_timer_fn(struct timer_list *t) iolat = blkg_to_lat(blkg); if (!iolat) - continue; + goto next; lat_info = &iolat->child_lat; cookie = atomic_read(&lat_info->scale_cookie); From patchwork Tue Jul 31 16:39:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josef Bacik X-Patchwork-Id: 10551057 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4CC6913BB for ; Tue, 31 Jul 2018 16:39:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3E8AE2AFF1 for ; Tue, 31 Jul 2018 16:39:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 316682B020; Tue, 31 Jul 2018 16:39:12 +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=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D390B2AFF1 for ; Tue, 31 Jul 2018 16:39:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727495AbeGaSUS (ORCPT ); Tue, 31 Jul 2018 14:20:18 -0400 Received: from mail-qk0-f193.google.com ([209.85.220.193]:38732 "EHLO mail-qk0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727135AbeGaSUS (ORCPT ); Tue, 31 Jul 2018 14:20:18 -0400 Received: by mail-qk0-f193.google.com with SMTP id 126-v6so10670304qke.5 for ; Tue, 31 Jul 2018 09:39:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=toxicpanda-com.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id:in-reply-to:references; bh=U8Xb3NV+V9zRWRUjwIItut9NuPjFnKqSu+91N/OFlys=; b=u2bCMyaHjlJQOBcXa84m0GsY2tSguLs+awJWLx4iGISlCLop/uTS0q0vnNPOP/BJLb TJPl9MprXxNNLYBX+fc7TnowvVYT/LWqP0e2aJpPLwXOyqJ9B0iX6oKSY1DKBSx62Qqr SulgVVji8VQuJclSYPzgjY0HRWZElhoErzSTIFCo1LlANNBXfj/YVqitu2Wq94i6akZz pngh/BlrtdlURsv6DkSLwdtZ94yWP2X0JyfoT8ZYz8e1THmlydhQQXk2vWSRSrxkZO+H GPJ72HqU5lC19TNeqUfRbe3Glad3NogluMY/syF0sCiIMfLY/TlcyVwYnHZmAvpN0jAO Dx4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=U8Xb3NV+V9zRWRUjwIItut9NuPjFnKqSu+91N/OFlys=; b=HtjshGtkinZqFpYHeuDF8GHFSzESRJzvohXKs9r4002aZec5RLTLA/vbTbP7Jh+PRI Np42/xQf7DGHL8yHjEgrj7UERJBem/AU2tJAGx8kSIq9BjbjuVJynOniEAdGNTRf4hsk NtIHr4X1g8djOSR+SqPyf+aBgcTU8DrVm7kA91SuZ7uPj/RC3CekkShdqXQfoQHIRxNN kOEw21+MXE7lam9xOoSkuUtPCcJ4e0SuZe6cnCpBP8yeMJ7CFih7MEf/0QowxEy8zlYm V6R67ENcBQ98eVyGBLDDunkfGsEFmw85Q48UVNVjMeOK33L7Yi5ThpJ557+8aDF5xzOv kgqg== X-Gm-Message-State: AOUpUlFESxvfqCg0aPhMmiJHPVVWMqD8gTO1JKinq7K12UdTxABU/MmE etebDlwQj7lZw2hX8UtZJGzrGejOhT4= X-Google-Smtp-Source: AAOMgpf04IDzxCAmL8OMiDBZC3uCdiraJ+7viK+73dwsDJFEDtHxQZ9sV4O7o/8zqjdUrxlY99VfnQ== X-Received: by 2002:a37:188c:: with SMTP id 12-v6mr20883856qky.72.1533055150480; Tue, 31 Jul 2018 09:39:10 -0700 (PDT) Received: from localhost ([107.15.81.208]) by smtp.gmail.com with ESMTPSA id o2-v6sm9208234qte.16.2018.07.31.09.39.09 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 31 Jul 2018 09:39:09 -0700 (PDT) From: Josef Bacik To: axboe@kernel.dk, linux-block@vger.kernel.org, kernel-team@fb.com Subject: [PATCH 2/3] blk-cgroup: hold the queue ref during throttling Date: Tue, 31 Jul 2018 12:39:03 -0400 Message-Id: <20180731163904.21856-3-josef@toxicpanda.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180731163904.21856-1-josef@toxicpanda.com> References: <20180731163904.21856-1-josef@toxicpanda.com> Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The blkg lifetime is protected by the queue lifetime, so we need to put the queue _after_ we're done using the blkg. Signed-off-by: Josef Bacik --- block/blk-cgroup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c index 1942357d7165..694595b29b8f 100644 --- a/block/blk-cgroup.c +++ b/block/blk-cgroup.c @@ -1759,10 +1759,10 @@ void blkcg_maybe_throttle_current(void) if (!blkg) goto out; rcu_read_unlock(); - blk_put_queue(q); blkcg_maybe_throttle_blkg(blkg, use_memdelay); blkg_put(blkg); + blk_put_queue(q); return; out: rcu_read_unlock(); From patchwork Tue Jul 31 16:39:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josef Bacik X-Patchwork-Id: 10551059 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BD6CB13B8 for ; Tue, 31 Jul 2018 16:39:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AF1512AFF1 for ; Tue, 31 Jul 2018 16:39:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A3A0E2B020; Tue, 31 Jul 2018 16:39:13 +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=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4F6462AFF1 for ; Tue, 31 Jul 2018 16:39:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727999AbeGaSUT (ORCPT ); Tue, 31 Jul 2018 14:20:19 -0400 Received: from mail-qt0-f194.google.com ([209.85.216.194]:39244 "EHLO mail-qt0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727135AbeGaSUT (ORCPT ); Tue, 31 Jul 2018 14:20:19 -0400 Received: by mail-qt0-f194.google.com with SMTP id q12-v6so16622047qtp.6 for ; Tue, 31 Jul 2018 09:39:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=toxicpanda-com.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id:in-reply-to:references; bh=Ynv16cRdCJokyiijLAYrdbaj8D0/BLE8Fbgp/55buuk=; b=wXOyV41QR6HeL9OO6K4SUnuZnTMUuqGHXRpOBsce4ed4RaPAoy92nwisu6SWIAxGAb Jp7nVdvEPx8SQpFcwc3wpoGurQMU5nhtGscs+3A/3m8FH2rpfKk5fO0+B8H8flnvhA+o WXAXw273v/UANGeWSLxhSolYZQ3o6D+rqDVqUTVMxnfnHNJpbs9l4vN/qnhF1JYeIK6x Oh9LXiKXYkysiKTdUyrnRGnxpVp56EHQuHJQ9WY9EGLU2yWLomH77m/7w9CSpUSKIPIa cjViQL04BheA2udvpsNTTm6zE+kCNJhYo+4uXhRbGRAPbSecwIJoic16+s7AyUwvptdv ZZ2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=Ynv16cRdCJokyiijLAYrdbaj8D0/BLE8Fbgp/55buuk=; b=puC2IkVtMr3cxQhic5j7peu6bgsWUQKGxparoVgE3SK9gBZTK4TXl2na7ync4XoYtN 6H3mFqqyGYCmCqTMwzk3K0EgW5uNh+lbvaM7gnKQK8y37vYZgoOdBPgo2/bR0IKHmL7F G7I9aph6x/Mz9d5HGddACrKqRRufGazgZaW68XoCYDQAeSN3DxieXQRJiVPlHgS4jHZI lvFNRFTJIWO9RcCj/dsqisrkJ9+CGNV6fGW/nc65IX8lg6eJualqHMNBLLlSgpSN4kzj jpa6ooej34fPvaUUmKNOJjmH55bUMrwKsmrlal+1I77DTDnKwcSGdgQ4FfdRo6WwfQ8V 8hCQ== X-Gm-Message-State: AOUpUlFwWnn19JIGLcWCccOrNGFR0oNoX0wVaCUKOYM/aY0zssi9l5eT RYV01oZla9LvXJv7bUfTE73oSg== X-Google-Smtp-Source: AAOMgpejxAbUHr7jmh06SxYl03BmHPqdymE7bapzp/ovlm8lLMyKAbZbR9DrLpxFyrvVU58t/kBnmw== X-Received: by 2002:aed:3c34:: with SMTP id t49-v6mr20593368qte.404.1533055152009; Tue, 31 Jul 2018 09:39:12 -0700 (PDT) Received: from localhost ([107.15.81.208]) by smtp.gmail.com with ESMTPSA id k3-v6sm11089353qta.37.2018.07.31.09.39.11 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 31 Jul 2018 09:39:11 -0700 (PDT) From: Josef Bacik To: axboe@kernel.dk, linux-block@vger.kernel.org, kernel-team@fb.com Subject: [PATCH 3/3] blk-cgroup: clear the throttle queue on fork Date: Tue, 31 Jul 2018 12:39:04 -0400 Message-Id: <20180731163904.21856-4-josef@toxicpanda.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180731163904.21856-1-josef@toxicpanda.com> References: <20180731163904.21856-1-josef@toxicpanda.com> Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP We were hitting a panic in production where we put too many times on the request queue. This is because we'd get the throttle_queue of the parent if we fork()'ed while we needed to be throttled, but we didn't have a reference on it. Instead just clear these flags on fork so the child doesn't pay for the sins of its father. Signed-off-by: Josef Bacik --- kernel/fork.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/kernel/fork.c b/kernel/fork.c index 9440d61b925c..694ae0e56866 100644 --- a/kernel/fork.c +++ b/kernel/fork.c @@ -843,6 +843,11 @@ static struct task_struct *dup_task_struct(struct task_struct *orig, int node) tsk->fail_nth = 0; #endif +#ifdef CONFIG_BLK_CGROUP + tsk->throttle_queue = NULL; + tsk->use_memdelay = 0; +#endif + return tsk; free_stack: