netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mihai Maruseac <mihai.maruseac@gmail.com>
To: Stephen Hemminger <shemminger@vyatta.com>
Cc: davem@davemloft.net, eric.dumazet@gmail.com,
	mirq-linux@rere.qmqm.pl, therbert@google.com, jpirko@redhat.com,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	dbaluta@ixiacom.com, Mihai Maruseac <mmaruseac@ixiacom.com>
Subject: Re: [PATCH] dev: use name hash for dev_seq_ops.
Date: Mon, 10 Oct 2011 11:43:20 +0300	[thread overview]
Message-ID: <CAOMsUMLRc5dT4kGyAUMLka2f=jTOCeYt8WEkNZPY+dwkrBhPeQ@mail.gmail.com> (raw)
In-Reply-To: <20111007092445.4f097ed9@nehalam.linuxnetplumber.net>

On Fri, Oct 7, 2011 at 7:24 PM, Stephen Hemminger <shemminger@vyatta.com> wrote:
> On Fri,  7 Oct 2011 18:20:49 +0300
> Mihai Maruseac <mihai.maruseac@gmail.com> wrote:
>
>> Instead of using the dev->next chain and trying to resync at each call to
>> dev_seq_start, use this hash and store bucket number and bucket offset in
>> seq->private field.
>>
>> As one can notice the improvement is of 1 order of magnitude.
>
> Good idea,
> This will change the ordering of entries in /proc which may upset
> some program, not a critical flaw but worth noting.
>
> Rather than recording the bucket and offset of last entry, another
> alternative would be to just record the ifindex.
>

I tried to record the ifindex but I think that using it and
dev_get_by_index can result in an infinite loop or a NULL
dereferrence. If a device is removed and ifindex points to it we'll
get a NULL from dev_get_by_index. Checking for NULL and calling again
dev_get_by_index will end in an infinite loop at the end of the hlist.

Augmenting the structure to also contain the number of indexes when
the seq_file is opened returns to the current situation with two ints.
Also, it is more prone to bugs caused by device removal while
printing.

-- 
Mihai

  parent reply	other threads:[~2011-10-10  8:43 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-07 15:20 [PATCH] dev: use name hash for dev_seq_ops Mihai Maruseac
2011-10-07 16:24 ` Stephen Hemminger
2011-10-08  7:22   ` Mihai Maruseac
2011-10-10  8:43   ` Mihai Maruseac [this message]
2011-10-11  5:55     ` Stephen Hemminger
2011-10-12 10:08       ` Mihai Maruseac
2011-10-12  9:49 ` [PATCH] dev: use ifindex " Mihai Maruseac
2011-10-12  9:57 ` Mihai Maruseac
2011-10-12  9:59   ` Mihai Maruseac
2011-10-12 15:50   ` Stephen Hemminger
2011-10-14 12:20     ` Mihai Maruseac
2011-10-14  9:53   ` Mihai Maruseac
2011-10-14 12:53     ` Eric Dumazet
2011-10-17  8:03       ` Daniel Baluta
2011-10-17 15:12         ` Stephen Hemminger
  -- strict thread matches above, loose matches on Subject: below --
2011-10-20  8:01 [PATCH] dev: use name " Mihai Maruseac
2011-10-20 20:17 ` David Miller
2011-10-21  6:45 ` Mihai Maruseac
2011-10-21  6:52   ` Eric Dumazet
2011-10-21  6:55   ` David Miller
2011-10-21 17:07   ` Stephen Hemminger

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='CAOMsUMLRc5dT4kGyAUMLka2f=jTOCeYt8WEkNZPY+dwkrBhPeQ@mail.gmail.com' \
    --to=mihai.maruseac@gmail.com \
    --cc=davem@davemloft.net \
    --cc=dbaluta@ixiacom.com \
    --cc=eric.dumazet@gmail.com \
    --cc=jpirko@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mirq-linux@rere.qmqm.pl \
    --cc=mmaruseac@ixiacom.com \
    --cc=netdev@vger.kernel.org \
    --cc=shemminger@vyatta.com \
    --cc=therbert@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).