From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752632AbcD1D3h (ORCPT ); Wed, 27 Apr 2016 23:29:37 -0400 Received: from szxga02-in.huawei.com ([119.145.14.65]:63378 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751103AbcD1D3f (ORCPT ); Wed, 27 Apr 2016 23:29:35 -0400 Message-ID: <57218384.4080609@huawei.com> Date: Thu, 28 Apr 2016 11:29:08 +0800 From: xiakaixu User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 MIME-Version: 1.0 To: Jens Axboe CC: , , , , , , "miaoxie (A)" , Huxinwei , Bintian Subject: Re: [PATCH 7/8] wbt: add general throttling mechanism References: <1461686131-22999-1-git-send-email-axboe@fb.com> <1461686131-22999-8-git-send-email-axboe@fb.com> <5720AB61.8010109@huawei.com> <5720D90F.6000609@fb.com> In-Reply-To: <5720D90F.6000609@fb.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-Originating-IP: [10.111.101.23] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020205.5721838F.0089,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2013-06-18 04:22:30, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: fd8156a9c3b2e431d7dfdddd86a3776c Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 于 2016/4/27 23:21, Jens Axboe 写道: > On 04/27/2016 06:06 AM, xiakaixu wrote: >>> +void __wbt_done(struct rq_wb *rwb) >>> +{ >>> + int inflight, limit = rwb->wb_normal; >>> + >>> + /* >>> + * If the device does write back caching, drop further down >>> + * before we wake people up. >>> + */ >>> + if (rwb->wc && !atomic_read(&rwb->bdi->wb.dirty_sleeping)) >>> + limit = 0; >>> + else >>> + limit = rwb->wb_normal; >>> + >>> + /* >>> + * Don't wake anyone up if we are above the normal limit. If >>> + * throttling got disabled (limit == 0) with waiters, ensure >>> + * that we wake them up. >>> + */ >>> + inflight = atomic_dec_return(&rwb->inflight); >>> + if (limit && inflight >= limit) { >>> + if (!rwb->wb_max) >>> + wake_up_all(&rwb->wait); >>> + return; >>> + } >>> + >> Hi Jens, >> >> Just a little confused about this. The rwb->wb_max can't be 0 if the variable >> 'limit' does not equal to 0. So the if (!rwb->wb_max) branch maybe does not >> make sense. > > You are right, it doesn't make a lot of sense. I think it suffers from code shuffling. How about the attached? The important part is that we wake up waiters, if wbt got disabled while we had tracked IO in flight. > Hi Jens, The modified patch in another mail looks better. Maybe there are still some places coube be improved. You can find them in that mail. -- Regards Kaixu Xia