All of lore.kernel.org
 help / color / mirror / Atom feed
From: Namhyung Kim <namhyung@kernel.org>
To: Tom Zanussi <tom.zanussi@linux.intel.com>
Cc: Steven Rostedt <rostedt@goodmis.org>,
	"linux-kernel\@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: About 'hash' event trigger patchset
Date: Fri, 04 Apr 2014 16:36:50 +0900	[thread overview]
Message-ID: <87vbupy299.fsf@sejong.aot.lge.com> (raw)
In-Reply-To: <1396450314.11878.90.camel@empanada> (Tom Zanussi's message of "Wed, 02 Apr 2014 09:51:54 -0500")

Hi Tom,

On Wed, 02 Apr 2014 09:51:54 -0500, Tom Zanussi wrote:
> Hi Namhyung,
>
> On Wed, 2014-04-02 at 08:31 +0000, Namhyung Kim wrote:
>> One thing I noticed in the main logic is that it seems there's no
>> limit checking when adding/creating new entry.  In
>> hash_trigger_entry_create(), there's a check against max_entries but
>> if it goes beyond the max, it'd just access a NULL pointer AFAICS.  Am
>> I missing something?  Also I don't know what the difference between
>> ->n_entries and ->total_entries (in hash_data).
>> 
>> I guess you wanted to set ->drops in that case, but I cannot find
>
> Yes, the code is missing a very important snippet, which I realized
> after hitting the problem.  My current code has this:
>
>         if (hash_data->drops)
>                 return NULL;

I think this part can be omitted since it's already checked earlier.
But it's a minor issue.


>         else if (hash_data->n_entries == hash_data->max_entries) {
>                 hash_data->drops = 1;
>                 return NULL;
>         }
>
> n_entries is the current number of entries used up, and max_entries is
> the total number of available entries (a cached value to avoid
> calculating it every time).

But there's "total_entries" - increased in hash_trigger_entry_insert() -
too and I think it's just same as n_entries.

>
>> where it gets set.  And I'm not sure it's good to check ->drop first,
>> since entry can find an existing entry and merged to it even if it
>> reached the max already.
>> 
>
> The assumption is that if you have any drops at all, you probably want
> to redo the test with a bigger table, but regardless the data reflects
> the situation up to the point the drops started happening.  Letting
> events that already have a entry merge while rejecting those that don't
> would invalidate the data you already have.

Okay, I won't insist on it.

Thanks,
Namhyung

  reply	other threads:[~2014-04-04  7:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-02  8:31 About 'hash' event trigger patchset Namhyung Kim
2014-04-02 14:51 ` Tom Zanussi
2014-04-04  7:36   ` Namhyung Kim [this message]
2014-04-05 18:47     ` Tom Zanussi

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=87vbupy299.fsf@sejong.aot.lge.com \
    --to=namhyung@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=tom.zanussi@linux.intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.