All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@conectiva.com.br>
To: "David S. Miller" <davem@davemloft.net>
Cc: Networking Team <netdev@oss.sgi.com>
Subject: [PATCH 1/12][SOCK] make sk_alloc use kmalloc for non performance critical families
Date: Fri, 21 Jan 2005 01:18:55 -0200	[thread overview]
Message-ID: <41F0749F.1020004@conectiva.com.br> (raw)

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

Hi David,

	Please see the log in the patch.

Regards,

- Arnaldo


[-- Attachment #2: 1-sk_alloc.patch --]
[-- Type: text/plain, Size: 1590 bytes --]

===================================================================


ChangeSet@1.1999, 2005-01-20 20:25:41-02:00, acme@toy.ghostprotocols.net
  [SOCK] make sk_alloc use kmalloc for non performance critical families
  
  With this we can have aggregate protocol specific struct proto_sock
  allocated for non performance critical protocols.
  
  We still check for slab == NULL && zero_it == 1 to allocate from the
  generic "sock" slab cache, but this will be removed when all the
  network families stop using sk_protinfo, when the generic "sock"
  slab cache will be removed.
  
  Signed-off-by: Arnaldo Carvalho de Melo <acme@conectiva.com.br>
  Signed-off-by: David S. Miller <davem@davemloft.net>


 sock.c |   17 ++++++++++++++---
 1 files changed, 14 insertions(+), 3 deletions(-)


diff -Nru a/net/core/sock.c b/net/core/sock.c
--- a/net/core/sock.c	2005-01-21 00:24:03 -02:00
+++ b/net/core/sock.c	2005-01-21 00:24:03 -02:00
@@ -621,9 +621,17 @@
 {
 	struct sock *sk = NULL;
 
-	if (!slab)
+	/*
+	 * Transitional, this test will be removed when sk_cachep is killed
+	 */
+	if (slab == NULL && zero_it == 1)
 		slab = sk_cachep;
-	sk = kmem_cache_alloc(slab, priority);
+
+	if (slab != NULL)
+		sk = kmem_cache_alloc(slab, priority);
+	else
+		sk = kmalloc(zero_it, priority);
+
 	if (sk) {
 		if (zero_it) {
 			memset(sk, 0,
@@ -662,7 +670,10 @@
 		       __FUNCTION__, atomic_read(&sk->sk_omem_alloc));
 
 	security_sk_free(sk);
-	kmem_cache_free(sk->sk_slab, sk);
+	if (sk->sk_slab != NULL)
+		kmem_cache_free(sk->sk_slab, sk);
+	else
+		kfree(sk);
 	module_put(owner);
 }
 



                 reply	other threads:[~2005-01-21  3:18 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=41F0749F.1020004@conectiva.com.br \
    --to=acme@conectiva.com.br \
    --cc=davem@davemloft.net \
    --cc=netdev@oss.sgi.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.