Re: [PATCH 07/10] writeback: factor out wb_dirty_freerun to remove more repeated freerun code

From: Kemeng Shi
Date: Sun May 05 2024 - 21:54:04 EST



Hello,
on 5/2/2024 1:18 AM, Tejun Heo wrote:
> On Mon, Apr 29, 2024 at 11:47:35AM +0800, Kemeng Shi wrote:
> ...
>> +static void wb_dirty_freerun(struct dirty_throttle_control *dtc,
>> + bool strictlimit)
>> +{
> ...
>> + /*
>> + * LOCAL_THROTTLE tasks must not be throttled when below the per-wb
>> + * freerun ceiling.
>> + */
>> + if (!(current->flags & PF_LOCAL_THROTTLE))
>> + return;
>
> Shouldn't this set free_run to true?
Originally, we will go freerun if PF_LOCAL_THROTTLE is set and number of dirty
pages is under freerun ceil. So if PF_LOCAL_THROTTLE is *not* set, freerun
should be false. Maybe I miss something and please correct me, Thanks.
>
> Also, wouldn't it be better if these functions return bool instead of
> recording the result in dtc->freerun?
As I try to factor out balance_wb_limits to calculate freerun, dirty_exceeded
and position ratio of wb, so wb_dirty_freerun and wb_dirty_exceeded will be
called indirectly and balance_dirty_pages has to retrieve freerun and
dirty_exceeded from somewhere like dtc where position ratio is retrieved.
Would like to know any better idea.
Thanks.
>
> Thanks.
>