mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alexey Dobriyan <adobriyan@gmail.com>
To: Lai Jiangshan <laijs@cn.fujitsu.com>
Cc: "David S. Miller" <davem@davemloft.net>,
	Andrew Morton <akpm@linux-foundation.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 5/7] net: use simple_free()
Date: Sun, 16 Nov 2008 07:54:57 +0300	[thread overview]
Message-ID: <20081116045457.GD24624@x200.localdomain> (raw)
In-Reply-To: <491FA2BC.1030600@cn.fujitsu.com>

On Sun, Nov 16, 2008 at 12:34:04PM +0800, Lai Jiangshan wrote:
> simple_free() free the memory by kfree(), or vfree() if it is vmalloc addr.
> simple_free() is simpler than current codes.

Where is corresponding alloc chunk?

> --- a/net/core/request_sock.c
> +++ b/net/core/request_sock.c
> @@ -71,22 +72,11 @@ int reqsk_queue_alloc(struct request_sock_queue *queue,
>  
>  void __reqsk_queue_destroy(struct request_sock_queue *queue)
>  {
> -	struct listen_sock *lopt;
> -	size_t lopt_size;
> -
>  	/*
>  	 * this is an error recovery path only
>  	 * no locking needed and the lopt is not NULL
>  	 */
> -
> -	lopt = queue->listen_opt;
> -	lopt_size = sizeof(struct listen_sock) +
> -		lopt->nr_table_entries * sizeof(struct request_sock *);
> -
> -	if (lopt_size > PAGE_SIZE)
> -		vfree(lopt);
> -	else
> -		kfree(lopt);
> +	simple_free(queue->listen_opt);
>  }
>  
>  static inline struct listen_sock *reqsk_queue_yank_listen_sk(
> @@ -106,8 +96,6 @@ void reqsk_queue_destroy(struct request_sock_queue *queue)
>  {
>  	/* make all the listen_opt local to us */
>  	struct listen_sock *lopt = reqsk_queue_yank_listen_sk(queue);
> -	size_t lopt_size = sizeof(struct listen_sock) +
> -		lopt->nr_table_entries * sizeof(struct request_sock *);
>  
>  	if (lopt->qlen != 0) {
>  		unsigned int i;
> @@ -124,9 +112,6 @@ void reqsk_queue_destroy(struct request_sock_queue *queue)
>  	}
>  
>  	WARN_ON(lopt->qlen != 0);
> -	if (lopt_size > PAGE_SIZE)
> -		vfree(lopt);
> -	else
> -		kfree(lopt);
> +	simple_free(lopt);
>  }

      reply	other threads:[~2008-11-16  4:51 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-16  4:34 Lai Jiangshan
2008-11-16  4:54 ` Alexey Dobriyan [this message]

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=20081116045457.GD24624@x200.localdomain \
    --to=adobriyan@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=davem@davemloft.net \
    --cc=laijs@cn.fujitsu.com \
    --cc=linux-kernel@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®