On Fri, Jan 26, 2024 at 08:08:00PM +0800, zhaoyang.huang wrote: > +#ifdef CONFIG_CONTENT_ACT_BASED_IOPRIO > +#define bio_add_page(bio, page, len, offset) \ > + ({ \ > + int class, level, hint, activity; \ > + int ret = 0; \ > + ret = bio_add_page(bio, page, len, offset); \ > + if (ret > 0) { \ > + class = IOPRIO_PRIO_CLASS(bio->bi_ioprio); \ > + level = IOPRIO_PRIO_LEVEL(bio->bi_ioprio); \ > + hint = IOPRIO_PRIO_HINT(bio->bi_ioprio); \ > + activity = IOPRIO_PRIO_ACTIVITY(bio->bi_ioprio); \ > + activity += (bio->bi_vcnt + 1 <= IOPRIO_NR_ACTIVITY && \ > + PageWorkingset(&folio->page)) ? 1 : 0; \ I know you didn't even compile this version. More importantly, conceptually it doesn't work. All kinds of pages get added to bios, and not all of them are file/anon pages. That PageWorkingset bit might well be reused for other purposes. Only the caller knows if this is file/anon memory. You can't do this here.