Re: [PATCH 1/2] workqueue: add io priority to work_struct

From: Lai Jiangshan
Date: Fri Jun 21 2024 - 04:09:32 EST


Hello

On Fri, Jun 21, 2024 at 2:27 PM Yi Sun <yi.sun@xxxxxxxxxx> wrote:

> index 4c38824f3ab4..d9969596bbc3 100644
> --- a/include/linux/workqueue_types.h
> +++ b/include/linux/workqueue_types.h
> @@ -17,6 +17,12 @@ struct work_struct {
> atomic_long_t data;
> struct list_head entry;
> work_func_t func;
> + /* 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;

I don't see any ioprio code being integrated into workqueue in your
patchset, from which what you need might be:

struct ioprio_work {
/******* the work item to be scheduled *******/
struct work_struct work;

/******* the stuff need for ioprio ******/

/* 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;
}

And if ioprio needs to be integrated into workqueue, it should be attributes
added to the workqueue itself as in the struct workqueue_attrs.

Thanks
Lai