All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alex Elder <elder@dreamhost.com>
To: ceph-devel@vger.kernel.org
Subject: [PATCH 3/5] libceph: get rid of zero_page_address
Date: Mon, 12 Mar 2012 17:40:23 -0500	[thread overview]
Message-ID: <4F5E7B57.7060606@dreamhost.com> (raw)
In-Reply-To: <4F5E79C6.6040301@dreamhost.com>

There's not a lot of benefit to zero_page_address, which basically
holds a mapping of the zero page through the life of the messenger
module.  Even with our own mapping, the sendpage interface where
it's used may need to kmap() it again.  It's almost certain to
be in low memory anyway.

So stop treating the zero page specially in write_partial_msg_pages()
and just get rid of zero_page_address entirely.

Signed-off-by: Alex Elder <elder@dreamhost.com>
---
  net/ceph/messenger.c |   11 ++---------
  1 files changed, 2 insertions(+), 9 deletions(-)

diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c
index adca1e6..4f1714c 100644
--- a/net/ceph/messenger.c
+++ b/net/ceph/messenger.c
@@ -61,7 +61,6 @@ static char addr_str[ADDR_STR_COUNT][MAX_ADDR_STR_LEN];
  static atomic_t addr_str_seq = ATOMIC_INIT(0);

  static struct page *zero_page;		/* used in certain error cases */
-static void *zero_page_address;		/* kernel virtual addr of zero_page */

  const char *ceph_pr_addr(const struct sockaddr_storage *ss)
  {
@@ -111,9 +110,6 @@ void _ceph_msgr_exit(void)
  		ceph_msgr_wq = NULL;
  	}

-	BUG_ON(zero_page_address == NULL);
-	zero_page_address = NULL;
-
  	BUG_ON(zero_page == NULL);
  	kunmap(zero_page);
  	page_cache_release(zero_page);
@@ -126,9 +122,6 @@ int ceph_msgr_init(void)
  	zero_page = ZERO_PAGE(0);
  	page_cache_get(zero_page);

-	BUG_ON(zero_page_address != NULL);
-	zero_page_address = kmap(zero_page);
-
  	ceph_msgr_wq = alloc_workqueue("ceph-msgr", WQ_NON_REENTRANT, 0);
  	if (ceph_msgr_wq)
  		return 0;
@@ -889,7 +882,7 @@ static int write_partial_msg_pages(struct 
ceph_connection *con)
  		} else {
  			page = zero_page;
  			if (do_datacrc)
-				kaddr = zero_page_address;
+				kaddr = kmap(page);
  		}
  		len = min_t(int, max_write - con->out_msg_pos.page_pos,
  			    total_max_write);
@@ -908,7 +901,7 @@ static int write_partial_msg_pages(struct 
ceph_connection *con)
  				      con->out_msg_pos.page_pos + page_shift,
  				      len, 1);

-		if (do_datacrc && kaddr != zero_page_address)
+		if (do_datacrc)
  			kunmap(page);

  		if (ret <= 0)
-- 
1.7.5.4


  parent reply	other threads:[~2012-03-12 22:40 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-12 22:33 [PATCH 0/5] libceph: page mapping in the messenger Alex Elder
2012-03-12 22:40 ` [PATCH 1/5] libceph: use kernel_sendpage() for sending zeroes Alex Elder
2012-03-12 22:40 ` [PATCH 2/5] libceph: only call kernel_sendpage() via helper Alex Elder
2012-03-12 22:40 ` Alex Elder [this message]
2012-03-12 22:40 ` [PATCH 4/5] libceph: rename "page_shift" variable to something sensible Alex Elder
2012-03-12 22:40 ` [PATCH 5/5] libceph: isolate kmap() call in write_partial_msg_pages() Alex Elder
2012-03-13  5:31 ` [PATCH 0/5] libceph: page mapping in the messenger Sage Weil

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=4F5E7B57.7060606@dreamhost.com \
    --to=elder@dreamhost.com \
    --cc=ceph-devel@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 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.