Hello, On Mon, Jul 01, 2024 at 03:51:37PM +0800, Yi Sun wrote: > +/* > + * If a work may do disk IO, it is recommended to use struct io_work > + * instead of struct work_struct. > + */ > +struct io_work { > + struct work_struct work; > + > + /* If the work does submit_bio, io priority may be needed. */ > + unsigned short ioprio; > + /* Record kworker's original io priority. */ > + unsigned short ori_ioprio; > + /* Whether the work has set io priority? */ > + long ioprio_flag; > +};
There are fundamental limitations to this approach in terms of prioritization. If you tag each work items with priority and then send them to the same workqueue, there's nothing preventing a low priority issuer from flooding the workqueue and causing a priority inversion. ie. To solve this properly, you need per-issuer-class workqueue so that the concurrency limit is not shared across different priorities. Now, this limited implementation, while incomplete and easy to defeat, may still be useful. After all, ioprio itself, I think, is flawed in the same way. If f2fs wants to implement this internally, that's okay, I suppose, but as a generic mechanism, I don't think this makes a lot of sense. Thanks. -- tejun _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel