Re: [RFC rdma-next] RDMA/core: Add attribute WQ_MEM_RECLAIM to workqueue "infiniband"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2020/2/21 1:46, Alexander Duyck wrote:
> On Tue, Feb 18, 2020 at 11:42 PM Yunsheng Lin <linyunsheng@xxxxxxxxxx> wrote:
> 
>> Ok, I may be wrong about the above usecase.
>> but the below commit explicitly state that network devices may be used in
>> memory reclaim path.
>>
>> 0a38c17a21a0 ("fm10k: Remove create_workqueue"):
>>
>> fm10k: Remove create_workqueue
>>
>> alloc_workqueue replaces deprecated create_workqueue().
>>
>> A dedicated workqueue has been used since the workitem (viz
>> fm10k_service_task, which manages and runs other subtasks) is involved in
>> normal device operation and requires forward progress under memory
>> pressure.
>>
>> create_workqueue has been replaced with alloc_workqueue with max_active
>> as 0 since there is no need for throttling the number of active work
>> items.
>>
>> Since network devices may be used in memory reclaim path,
>> WQ_MEM_RECLAIM has been set to guarantee forward progress.
>>
>> flush_workqueue is unnecessary since destroy_workqueue() itself calls
>> drain_workqueue() which flushes repeatedly till the workqueue
>> becomes empty. Hence the call to flush_workqueue() has been dropped.
>>
>> Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@xxxxxxxxx>
>> Acked-by: Tejun Heo <tj@xxxxxxxxxx>
>> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@xxxxxxxxx>
>>
>> So:
>> 1. Maybe the above commit log is misleading, and network device driver's
>>    wq does not need the WQ_MEM_RECLAIM flag, then maybe document what can
>>    not be done in the work queued to wq marked with WQ_MEM_RECLAIM, and
>>    remove the WQ_MEM_RECLAIM flag for the wq of network device driver.
> 
> I am not sure why they added WQ_MEM_RECLAIM to the fm10k service task
> thread. It has nothing to do with memory reclaim. If a memory
> allocation fails then it will just run to the end and bring the
> interface down. The service task is related to dealing with various
> one-off events like link up and link down, sorting out hangs, and
> updating statistics. The only memory allocation it is involved with is
> if it has to reset the interface in which case I believe there may
> even be a few GFP_KERNEL calls in there since it is freeing and
> reallocating several port related structures.

Yes, the hns3 driver does a few GFP_KERNEL calls too when resetting the
interface in hclge_reset_service_task(), which will run in the hns3 driver'
wq.

> 
>> 2. If the network device driver's wq does need the WQ_MEM_RECLAIM flag, then
>>    hns3 may have tow problems here: WQ_MEM_RECLAIM wq flushing !WQ_MEM_RECLAIM
>>    wq problem and GFP_KERNEL allocations in the work queued to WQ_MEM_RECLAIM wq.
> 
> It seems like you could solve this by going the other way and dropping
> the WQ_MEM_RECLAIM from the original patch you mentioned in your fixes
> tag. I'm not seeing anything in hclge_periodic_service_task that
> justifies the use of the WQ_MEM_RECLAIM flag. It claims to be involved
> with memory reclaim but I don't see where that could be the case.

Ok, Will remove the WQ_MEM_RECLAIM first.

Thanks.

> 
> - Alex
> 
> .
> 




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux