From: Joe Perches <joe@perches.com>
To: Ezequiel Garcia <elezegarcia@gmail.com>
Cc: gregkh <gregkh@linuxfoundation.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Dan Carpenter <dan.carpenter@oracle.com>,
kernelnewbies <kernelnewbies@kernelnewbies.org>,
kernel-janitors@vger.kernel.org,
linux-media <linux-media@vger.kernel.org>,
devel@driverdev.osuosl.org
Subject: Re: Question about printking
Date: Sat, 02 Feb 2013 11:43:31 -0800 [thread overview]
Message-ID: <1359834211.2831.5.camel@joe-AO722> (raw)
In-Reply-To: <CALF0-+V-8m1TwnM0MUbNCncnECF_r_FVcyu_Duu0tqcsPoFR5A@mail.gmail.com>
On Sat, 2013-02-02 at 16:30 -0300, Ezequiel Garcia wrote:
> ptr = kmalloc(sizeof(foo));
> if (!ptr) {
> pr_err("Cannot allocate memory for foo\n");
> return -ENOMEM;
> }
> His argue against it was that kmalloc already takes care of reporting/printking
> a good deal of interesting information when this happens.
> Can someone expand a bit on this whole idea? (of abuse of printing,
> or futility of printing).
k.alloc() takes a GFP_ flag as an arg.
One of those GFP flags is __GFP_NOWARN.
For all failed allocs without GFP_NOWARN
a message is emitted and a dump_stack is
done.
(see: mm/page_alloc.c warn_alloc_failed())
So, most all of these printks after
k.alloc()'s are not necessary.
next prev parent reply other threads:[~2013-02-02 19:43 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CALF0-+XX27u4rmpe8RHiy5DsbHvoYP9DWQts+rTRfEvPQG4s8Q@mail.gmail.com>
2013-02-02 19:30 ` Ezequiel Garcia
2013-02-02 19:43 ` Joe Perches [this message]
2013-02-04 20:40 ` Ezequiel Garcia
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=1359834211.2831.5.camel@joe-AO722 \
--to=joe@perches.com \
--cc=dan.carpenter@oracle.com \
--cc=devel@driverdev.osuosl.org \
--cc=elezegarcia@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=kernelnewbies@kernelnewbies.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
/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
all inboxes | Powered by JetHome®