From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Subject: Re: [PATCH v6 11/12] block: Change the runtime power management approach (2/2) To: Bart Van Assche , Jens Axboe Cc: linux-block@vger.kernel.org, Christoph Hellwig , Ming Lei , Hannes Reinecke , Johannes Thumshirn , Alan Stern References: <20180809194149.15285-1-bart.vanassche@wdc.com> <20180809194149.15285-12-bart.vanassche@wdc.com> From: "jianchao.wang" Message-ID: Date: Fri, 10 Aug 2018 09:51:12 +0800 MIME-Version: 1.0 In-Reply-To: <20180809194149.15285-12-bart.vanassche@wdc.com> Content-Type: text/plain; charset=utf-8 List-ID: Hi Bart On 08/10/2018 03:41 AM, Bart Van Assche wrote: > + > + blk_set_pm_only(q); > + /* > + * This function only gets called if the most recent > + * pm_request_resume() call occurred at least autosuspend_delay_ms > + * ago. Since blk_queue_enter() is called by the request allocation > + * code before pm_request_resume(), if no requests have a tag assigned > + * it is safe to suspend the device. > + */ > + ret = -EBUSY; > + if (blk_requests_in_flight(q) == 0) { > + /* > + * Call synchronize_rcu() such that later blk_queue_enter() > + * calls see the preempt-only state. See also > + * https://urldefense.proofpoint.com/v2/url?u=http-3A__lwn.net_Articles_573497_&d=DwIBAg&c=RoP1YumCXCgaWHvlZYR8PZh8Bv7qIrMUB65eapI_JnE&r=7WdAxUBeiTUTCy8v-7zXyr4qk7sx26ATvfo6QSTvZyQ&m=U9uPCJD2WnkXvdzrWaKPh2wJuk8-IHvxZ9sWDVrg2Tg&s=c9E23TPCpNQkiZpuzGztwHxjWF8qrESfRnPmI-e-Z48&e=. > + */ > + synchronize_rcu(); > + if (blk_requests_in_flight(q) == 0) > + ret = 0; > + } I still think blk_set_pm_only should be moved after blk_requests_in_flight. Otherwise, the normal IO will be blocked for a little while if there are still busy requests. Thanks Jianchao