mm/memory.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
Constify the unit computation. Also, cleans up the comment
a little bit.
Signed-off-by: Ankur Arora <ankur.a.arora@oracle.com>
---
mm/memory.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/mm/memory.c b/mm/memory.c
index 11ad1db61929..95dc21ca120f 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -7240,19 +7240,19 @@ static inline int process_huge_page(
static void clear_contig_highpages(struct page *page, unsigned long addr,
unsigned int nr_pages)
{
- unsigned int i, unit, count;
-
- might_sleep();
+ unsigned int i, count;
/*
- * When clearing we want to operate on the largest extent possible since
- * that allows for extent based architecture specific optimizations.
+ * When clearing we want to operate on the largest extent possible to
+ * allow for for architecture specific extent based optimizations.
*
- * However, since the clearing interfaces (clear_user_highpages(),
- * clear_user_pages(), clear_pages()), do not call cond_resched(), we
- * limit the batch size when running under non-preemptible scheduling
- * models.
+ * However, since clear_user_highpages() (and primitives clear_user_pages(),
+ * clear_pages()), do not call cond_resched(), limit the unit size when
+ * running under non-preemptible scheduling models.
*/
- unit = preempt_model_preemptible() ? nr_pages : PROCESS_PAGES_NON_PREEMPT_BATCH;
+ const unsigned int unit = preempt_model_preemptible() ?
+ nr_pages : PROCESS_PAGES_NON_PREEMPT_BATCH;
+
+ might_sleep();
for (i = 0; i < nr_pages; i += count) {
cond_resched();
--
2.31.1
Hi Andrew,
Sorry, please ignore this patch.
Thanks
Ankur
Ankur Arora <ankur.a.arora@oracle.com> writes:
> Constify the unit computation. Also, cleans up the comment
> a little bit.
>
> Signed-off-by: Ankur Arora <ankur.a.arora@oracle.com>
> ---
> mm/memory.c | 20 ++++++++++----------
> 1 file changed, 10 insertions(+), 10 deletions(-)
>
> diff --git a/mm/memory.c b/mm/memory.c
> index 11ad1db61929..95dc21ca120f 100644
> --- a/mm/memory.c
> +++ b/mm/memory.c
> @@ -7240,19 +7240,19 @@ static inline int process_huge_page(
> static void clear_contig_highpages(struct page *page, unsigned long addr,
> unsigned int nr_pages)
> {
> - unsigned int i, unit, count;
> -
> - might_sleep();
> + unsigned int i, count;
> /*
> - * When clearing we want to operate on the largest extent possible since
> - * that allows for extent based architecture specific optimizations.
> + * When clearing we want to operate on the largest extent possible to
> + * allow for for architecture specific extent based optimizations.
> *
> - * However, since the clearing interfaces (clear_user_highpages(),
> - * clear_user_pages(), clear_pages()), do not call cond_resched(), we
> - * limit the batch size when running under non-preemptible scheduling
> - * models.
> + * However, since clear_user_highpages() (and primitives clear_user_pages(),
> + * clear_pages()), do not call cond_resched(), limit the unit size when
> + * running under non-preemptible scheduling models.
> */
> - unit = preempt_model_preemptible() ? nr_pages : PROCESS_PAGES_NON_PREEMPT_BATCH;
> + const unsigned int unit = preempt_model_preemptible() ?
> + nr_pages : PROCESS_PAGES_NON_PREEMPT_BATCH;
> +
> + might_sleep();
>
> for (i = 0; i < nr_pages; i += count) {
> cond_resched();
--
ankur
© 2016 - 2026 Red Hat, Inc.