page_reporting.c (668a89907c6b908c4a72ef22e70bbc95efca2000) | page_reporting.c (23baf831a32c04f9a968812511540b1b3e648bf5) |
---|---|
1// SPDX-License-Identifier: GPL-2.0 2#include <linux/mm.h> 3#include <linux/mmzone.h> 4#include <linux/page_reporting.h> 5#include <linux/gfp.h> 6#include <linux/export.h> 7#include <linux/module.h> 8#include <linux/delay.h> --- 6 unchanged lines hidden (view full) --- 15unsigned int page_reporting_order = -1; 16 17static int page_order_update_notify(const char *val, const struct kernel_param *kp) 18{ 19 /* 20 * If param is set beyond this limit, order is set to default 21 * pageblock_order value 22 */ | 1// SPDX-License-Identifier: GPL-2.0 2#include <linux/mm.h> 3#include <linux/mmzone.h> 4#include <linux/page_reporting.h> 5#include <linux/gfp.h> 6#include <linux/export.h> 7#include <linux/module.h> 8#include <linux/delay.h> --- 6 unchanged lines hidden (view full) --- 15unsigned int page_reporting_order = -1; 16 17static int page_order_update_notify(const char *val, const struct kernel_param *kp) 18{ 19 /* 20 * If param is set beyond this limit, order is set to default 21 * pageblock_order value 22 */ |
23 return param_set_uint_minmax(val, kp, 0, MAX_ORDER-1); | 23 return param_set_uint_minmax(val, kp, 0, MAX_ORDER); |
24} 25 26static const struct kernel_param_ops page_reporting_param_ops = { 27 .set = &page_order_update_notify, 28 /* 29 * For the get op, use param_get_int instead of param_get_uint. 30 * This is to make sure that when unset the initialized value of 31 * -1 is shown correctly --- 239 unchanged lines hidden (view full) --- 271 /* 272 * Cancel request if insufficient free memory or if we failed 273 * to allocate page reporting statistics for the zone. 274 */ 275 if (!zone_watermark_ok(zone, 0, watermark, 0, ALLOC_CMA)) 276 return err; 277 278 /* Process each free list starting from lowest order/mt */ | 24} 25 26static const struct kernel_param_ops page_reporting_param_ops = { 27 .set = &page_order_update_notify, 28 /* 29 * For the get op, use param_get_int instead of param_get_uint. 30 * This is to make sure that when unset the initialized value of 31 * -1 is shown correctly --- 239 unchanged lines hidden (view full) --- 271 /* 272 * Cancel request if insufficient free memory or if we failed 273 * to allocate page reporting statistics for the zone. 274 */ 275 if (!zone_watermark_ok(zone, 0, watermark, 0, ALLOC_CMA)) 276 return err; 277 278 /* Process each free list starting from lowest order/mt */ |
279 for (order = page_reporting_order; order < MAX_ORDER; order++) { | 279 for (order = page_reporting_order; order <= MAX_ORDER; order++) { |
280 for (mt = 0; mt < MIGRATE_TYPES; mt++) { 281 /* We do not pull pages from the isolate free list */ 282 if (is_migrate_isolate(mt)) 283 continue; 284 285 err = page_reporting_cycle(prdev, zone, order, mt, 286 sgl, &offset); 287 if (err) --- 77 unchanged lines hidden (view full) --- 365 /* 366 * If the page_reporting_order value is not set, we check if 367 * an order is provided from the driver that is performing the 368 * registration. If that is not provided either, we default to 369 * pageblock_order. 370 */ 371 372 if (page_reporting_order == -1) { | 280 for (mt = 0; mt < MIGRATE_TYPES; mt++) { 281 /* We do not pull pages from the isolate free list */ 282 if (is_migrate_isolate(mt)) 283 continue; 284 285 err = page_reporting_cycle(prdev, zone, order, mt, 286 sgl, &offset); 287 if (err) --- 77 unchanged lines hidden (view full) --- 365 /* 366 * If the page_reporting_order value is not set, we check if 367 * an order is provided from the driver that is performing the 368 * registration. If that is not provided either, we default to 369 * pageblock_order. 370 */ 371 372 if (page_reporting_order == -1) { |
373 if (prdev->order > 0 && prdev->order < MAX_ORDER) | 373 if (prdev->order > 0 && prdev->order <= MAX_ORDER) |
374 page_reporting_order = prdev->order; 375 else 376 page_reporting_order = pageblock_order; 377 } 378 379 /* initialize state and work structures */ 380 atomic_set(&prdev->state, PAGE_REPORTING_IDLE); 381 INIT_DELAYED_WORK(&prdev->work, &page_reporting_process); --- 36 unchanged lines hidden --- | 374 page_reporting_order = prdev->order; 375 else 376 page_reporting_order = pageblock_order; 377 } 378 379 /* initialize state and work structures */ 380 atomic_set(&prdev->state, PAGE_REPORTING_IDLE); 381 INIT_DELAYED_WORK(&prdev->work, &page_reporting_process); --- 36 unchanged lines hidden --- |