linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Valdis.Kletnieks@vt.edu
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Jiri Kosina <jkosina@suse.cz>, Christoph Lameter <cl@linux.com>,
	Pekka Enberg <penberg@kernel.org>,
	David Rientjes <rientjes@google.com>,
	Joonsoo Kim <iamjoonsoo.kim@lge.com>,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	Dan Carpenter <dan.carpenter@oracle.com>,
	Theodore Ts'o <tytso@mit.edu>
Subject: Re: [PATCH] mm/sl[aou]b: make kfree() aware of error pointers
Date: Wed, 10 Sep 2014 01:15:15 -0400	[thread overview]
Message-ID: <113623.1410326115@turing-police.cc.vt.edu> (raw)
In-Reply-To: Your message of "Tue, 09 Sep 2014 16:21:14 -0700." <20140909162114.44b3e98cf925f125e84a8a06@linux-foundation.org>

[-- Attachment #1: Type: text/plain, Size: 1048 bytes --]

On Tue, 09 Sep 2014 16:21:14 -0700, Andrew Morton said:
> On Tue, 9 Sep 2014 23:25:28 +0200 (CEST) Jiri Kosina <jkosina@suse.cz> wrote:
> kfree() is quite a hot path to which this will add overhead.  And we
> have (as far as we know) no code which will actually use this at
> present.

We already do a check for ZERO_SIZE_PTR, and given that dereferencing *that* is
instant death for the kernel, and we see it very rarely, I'm going to guess
that IS_ERR(ptr) *has* to be true more often than ZERO_SIZE_PTR, and thus even
more advantageous to short-circuit.

I guess it depends on a few things:

1) How many instances of 'if (!IS_ERR(foo)) kfree(foo);' are in the tree, and
what percent of kfree() calls executed have the guard on them

2) How many of the hot calls can/will get the guard removed.

3) How many cycles, if any, this adds to the path (a non-trivial question on
superscalar architectures), compared with doing a test before calling kfree()

I unfortunately have no earthly clue what the values of any of those
three quantities are....

[-- Attachment #2: Type: application/pgp-signature, Size: 848 bytes --]

  parent reply	other threads:[~2014-09-10  5:15 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-09 21:25 Jiri Kosina
2014-09-09 23:21 ` Andrew Morton
2014-09-10  5:05   ` Jiri Kosina
2014-09-10  5:11     ` Andrew Morton
2014-09-10  6:36       ` Dan Carpenter
2014-09-10 13:56         ` Theodore Ts'o
2014-09-10 14:27           ` Dave Jones
2014-09-10 14:07     ` Theodore Ts'o
2014-09-10 14:24       ` Jiri Kosina
2014-09-10 14:33         ` Andrey Ryabinin
2014-09-10 14:42           ` Jiri Kosina
2014-09-10 15:43         ` Christoph Lameter
2014-09-10 14:26       ` Jiri Kosina
2014-09-10 15:21         ` Dan Carpenter
2014-09-10 15:28           ` Jiri Kosina
2014-09-10 15:53             ` Dan Carpenter
2014-09-10 19:40               ` Theodore Ts'o
2014-09-11 14:14             ` Rasmus Villemoes
2014-09-10 14:22     ` Christoph Lameter
2014-09-10  5:15   ` Valdis.Kletnieks [this message]
2014-09-10  6:51     ` Dan Carpenter
2014-09-10 13:59   ` Christoph Lameter

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=113623.1410326115@turing-police.cc.vt.edu \
    --to=valdis.kletnieks@vt.edu \
    --cc=akpm@linux-foundation.org \
    --cc=cl@linux.com \
    --cc=dan.carpenter@oracle.com \
    --cc=iamjoonsoo.kim@lge.com \
    --cc=jkosina@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=penberg@kernel.org \
    --cc=rientjes@google.com \
    --cc=tytso@mit.edu \
    /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