public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Changli Gao <xiaosuo@gmail.com>
Cc: "David S. Miller" <davem@davemloft.net>,
	Jiri Pirko <jpirko@redhat.com>,
	Neil Horman <nhorman@tuxdriver.com>,
	netdev@vger.kernel.org
Subject: Re: [PATCH 2/2] af_packet: replace struct pgv with char **
Date: Tue, 30 Nov 2010 15:16:08 +0100	[thread overview]
Message-ID: <1291126568.2904.85.camel@edumazet-laptop> (raw)
In-Reply-To: <1291125457-14427-1-git-send-email-xiaosuo@gmail.com>

Le mardi 30 novembre 2010 à 21:57 +0800, Changli Gao a écrit :
> As we can check if an address is vmalloc address with is_vmalloc_addr(),
> we can replace struct pgv with char **. Then we may get more pg_vecs.
> 
> Signed-off-by: Changli Gao <xiaosuo@gmail.com>
> ---
>  net/packet/af_packet.c |   50 ++++++++++++++++---------------------------------
>  1 file changed, 17 insertions(+), 33 deletions(-)
> diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
> index 0171b20..a26f981 100644
> --- a/net/packet/af_packet.c
> +++ b/net/packet/af_packet.c
> @@ -164,14 +164,8 @@ struct packet_mreq_max {
>  static int packet_set_ring(struct sock *sk, struct tpacket_req *req,
>  		int closing, int tx_ring);
>  
> -#define PGV_FROM_VMALLOC 1
> -struct pgv {
> -	char *buffer;
> -	unsigned char flags;
> -};
> -

This patch is premature.

Also, keep the struct pgv, even if it has a single field, since having
types is good to read the sources.

We could have 'void *' or 'char *' everywhere, it is not nice...


-       pg_vec = kcalloc(block_nr, sizeof(struct pgv), GFP_KERNEL);
+       pg_vec = kcalloc(block_nr, sizeof(char *), GFP_KERNEL);

I prefer to have :

       pg_vec = kcalloc(block_nr, sizeof(struct pgv), GFP_KERNEL);



  reply	other threads:[~2010-11-30 14:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-30 13:57 [PATCH 2/2] af_packet: replace struct pgv with char ** Changli Gao
2010-11-30 14:16 ` Eric Dumazet [this message]
2010-11-30 14:30   ` Changli Gao

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=1291126568.2904.85.camel@edumazet-laptop \
    --to=eric.dumazet@gmail.com \
    --cc=davem@davemloft.net \
    --cc=jpirko@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=nhorman@tuxdriver.com \
    --cc=xiaosuo@gmail.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