On Mon, Feb 20, 2023 at 04:38:10PM +0500, Muhammad Usama Anjum wrote: > On 2/20/23 3:38 PM, Muhammad Usama Anjum wrote: > >>> +#define PAGEMAP_BITS_ALL (PAGE_IS_WRITTEN | PAGE_IS_FILE | \ > >>> + PAGE_IS_PRESENT | PAGE_IS_SWAPPED) > >>> +#define PAGEMAP_NON_WRITTEN_BITS (PAGE_IS_FILE | PAGE_IS_PRESENT | PAGE_IS_SWAPPED) > >>> +#define IS_WP_ENGAGE_OP(a) (a->flags & PAGEMAP_WP_ENGAGE) > >>> +#define IS_GET_OP(a) (a->vec) > >>> +#define HAS_NO_SPACE(p) (p->max_pages && (p->found_pages == p->max_pages)) > >>> + > >>> +#define PAGEMAP_SCAN_BITMAP(wt, file, present, swap) \ > >>> + (wt | file << 1 | present << 2 | swap << 3) > >>> +#define IS_WT_REQUIRED(a) \ > >>> + ((a->required_mask & PAGE_IS_WRITTEN) || \ > >>> + (a->anyof_mask & PAGE_IS_WRITTEN)) > >> All these macros are specific to pagemap_scan_ioctl() and should be > >> namespaced accordingly, e.g. PM_SCAN_BITS_ALL, PM_SCAN_BITMAP etc. > >> > >> Also, IS_<opname>_OP() will be more readable as PM_SCAN_OP_IS_<opname> and > >> I'd suggest to open code IS_WP_ENGAGE_OP() and IS_GET_OP() and make > >> HAS_NO_SPACE() and IS_WT_REQUIRED() static inlines rather than macros. > > Will do in next version. > > > > IS_WP_ENGAGE_OP() and IS_GET_OP() which can be renamed to > PM_SCAN_OP_IS_WP() and PM_SCAN_OP_IS_GET() seem better to me instead of > open code as they seem more readable to me. I can open code if you insist. I'd suggest to see how the rework of pagemap_scan_pmd_entry() paves out. An open-coded '&' is surely clearer than a macro/function, but if it's buried in a long sequence of conditions, it may be not such clear win. > -- > BR, > Muhammad Usama Anjum -- Sincerely yours, Mike.