From: Andrew Morton <akpm@linux-foundation.org>
To: Aleksandr Nogikh <nogikh@google.com>
Cc: kasan-dev@googlegroups.com, linux-kernel@vger.kernel.org,
dvyukov@google.com, andreyknvl@gmail.com, elver@google.com,
glider@google.com, tarasmadan@google.com, bigeasy@linutronix.de
Subject: Re: [PATCH v3] kcov: don't generate a warning on vm_insert_page()'s failure
Date: Mon, 4 Apr 2022 15:22:52 -0700 [thread overview]
Message-ID: <20220404152252.af0c9c9127455e9cf5e632fb@linux-foundation.org> (raw)
In-Reply-To: <20220401182512.249282-1-nogikh@google.com>
On Fri, 1 Apr 2022 18:25:12 +0000 Aleksandr Nogikh <nogikh@google.com> wrote:
> vm_insert_page()'s failure is not an unexpected condition, so don't do
> WARN_ONCE() in such a case.
>
> Instead, print a kernel message and just return an error code.
>
> ...
>
> --- a/kernel/kcov.c
> +++ b/kernel/kcov.c
> @@ -475,8 +475,11 @@ static int kcov_mmap(struct file *filep, struct vm_area_struct *vma)
> vma->vm_flags |= VM_DONTEXPAND;
> for (off = 0; off < size; off += PAGE_SIZE) {
> page = vmalloc_to_page(kcov->area + off);
> - if (vm_insert_page(vma, vma->vm_start + off, page))
> - WARN_ONCE(1, "vm_insert_page() failed");
> + res = vm_insert_page(vma, vma->vm_start + off, page);
> + if (res) {
> + pr_warn_once("kcov: vm_insert_page() failed\n");
> + return res;
> + }
> }
> return 0;
> exit:
Can you explain the rationale here? If vm_insert_page() failure is an
expected condition, why warn at all?
I'm struggling to understand why a condition is worth a printk, but not
a WARN.
Some explanation of what leads to the vm_insert_page() failure would
have been helpful.
next prev parent reply other threads:[~2022-04-04 23:02 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-01 18:25 [PATCH v3] kcov: don't generate a warning on vm_insert_page()'s failure Aleksandr Nogikh
2022-04-04 22:22 ` Andrew Morton [this message]
2022-04-14 21:24 ` Andrew Morton
2022-04-15 8:24 ` Marco Elver
2022-04-15 9:17 ` Aleksandr Nogikh
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220404152252.af0c9c9127455e9cf5e632fb@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=andreyknvl@gmail.com \
--cc=bigeasy@linutronix.de \
--cc=dvyukov@google.com \
--cc=elver@google.com \
--cc=glider@google.com \
--cc=kasan-dev@googlegroups.com \
--cc=linux-kernel@vger.kernel.org \
--cc=nogikh@google.com \
--cc=tarasmadan@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).