mm/damon/dbgfs: use '__GFP_NOWARN' for user-specified size buffer allocation

Patch series "DAMON fixes".

This patch (of 2):

DAMON users can trigger below warning in '__alloc_pages()' by invoking
write() to some DAMON debugfs files with arbitrarily high count
argument, because DAMON debugfs interface allocates some buffers based
on the user-specified 'count'.

if (unlikely(order >= MAX_ORDER)) {
WARN_ON_ONCE(!(gfp & __GFP_NOWARN));
return NULL;
}

Because the DAMON debugfs interface code checks failure of the
'kmalloc()', this commit simply suppresses the warnings by adding
'__GFP_NOWARN' flag.

Link: https://lkml.kernel.org/r/20211110145758.16558-1-sj@kernel.org
Link: https://lkml.kernel.org/r/20211110145758.16558-2-sj@kernel.org
Fixes: 4bc05954d007 ("mm/damon: implement a debugfs-based user space interface")
Signed-off-by: SeongJae Park <sj@kernel.org>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by SeongJae Park and committed by Linus Torvalds db7a347b cab71f74

+4 -4
+4 -4
mm/damon/dbgfs.c
··· 32 32 if (*ppos) 33 33 return ERR_PTR(-EINVAL); 34 34 35 - kbuf = kmalloc(count + 1, GFP_KERNEL); 35 + kbuf = kmalloc(count + 1, GFP_KERNEL | __GFP_NOWARN); 36 36 if (!kbuf) 37 37 return ERR_PTR(-ENOMEM); 38 38 ··· 133 133 char *kbuf; 134 134 ssize_t len; 135 135 136 - kbuf = kmalloc(count, GFP_KERNEL); 136 + kbuf = kmalloc(count, GFP_KERNEL | __GFP_NOWARN); 137 137 if (!kbuf) 138 138 return -ENOMEM; 139 139 ··· 452 452 char *kbuf; 453 453 ssize_t len; 454 454 455 - kbuf = kmalloc(count, GFP_KERNEL); 455 + kbuf = kmalloc(count, GFP_KERNEL | __GFP_NOWARN); 456 456 if (!kbuf) 457 457 return -ENOMEM; 458 458 ··· 578 578 char *kbuf; 579 579 ssize_t len; 580 580 581 - kbuf = kmalloc(count, GFP_KERNEL); 581 + kbuf = kmalloc(count, GFP_KERNEL | __GFP_NOWARN); 582 582 if (!kbuf) 583 583 return -ENOMEM; 584 584