From: Stefan Richter <stefanr@s5r6.in-berlin.de>
To: linux-media@vger.kernel.org
Cc: linux1394-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org
Subject: [PATCH 1/6] firedtv: shrink buffer pointer table
Date: Wed, 18 Nov 2009 20:00:55 +0100 (CET) [thread overview]
Message-ID: <tkrat.6b9442a2f97654ef@s5r6.in-berlin.de> (raw)
In-Reply-To: <tkrat.7dc1f889fd1b69ad@s5r6.in-berlin.de>
Cache only addresses of whole pages, not of each buffer chunk. Besides,
page addresses can be obtained by page_address() instead of kmap() since
they were allocated in lowmem.
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
---
drivers/media/dvb/firewire/firedtv-fw.c | 19 ++++++++-----------
1 file changed, 8 insertions(+), 11 deletions(-)
Index: linux-2.6.32-rc7/drivers/media/dvb/firewire/firedtv-fw.c
===================================================================
--- linux-2.6.32-rc7.orig/drivers/media/dvb/firewire/firedtv-fw.c
+++ linux-2.6.32-rc7/drivers/media/dvb/firewire/firedtv-fw.c
@@ -6,9 +6,9 @@
#include <linux/errno.h>
#include <linux/firewire.h>
#include <linux/firewire-constants.h>
-#include <linux/highmem.h>
#include <linux/kernel.h>
#include <linux/list.h>
+#include <linux/mm.h>
#include <linux/slab.h>
#include <linux/spinlock.h>
#include <linux/types.h>
@@ -73,7 +73,7 @@ struct firedtv_receive_context {
struct fw_iso_buffer buffer;
int interrupt_packet;
int current_packet;
- char *packets[N_PACKETS];
+ char *pages[N_PAGES];
};
static int queue_iso(struct firedtv_receive_context *ctx, int index)
@@ -100,7 +100,7 @@ static void handle_iso(struct fw_iso_con
struct firedtv *fdtv = data;
struct firedtv_receive_context *ctx = fdtv->backend_data;
__be32 *h, *h_end;
- int i = ctx->current_packet, length, err;
+ int length, err, i = ctx->current_packet;
char *p, *p_end;
for (h = header, h_end = h + header_length / 4; h < h_end; h++) {
@@ -110,7 +110,8 @@ static void handle_iso(struct fw_iso_con
length = MAX_PACKET_SIZE;
}
- p = ctx->packets[i];
+ p = ctx->pages[i / PACKETS_PER_PAGE]
+ + (i % PACKETS_PER_PAGE) * MAX_PACKET_SIZE;
p_end = p + length;
for (p += CIP_HEADER_SIZE + MPEG2_TS_HEADER_SIZE; p < p_end;
@@ -130,8 +131,7 @@ static int start_iso(struct firedtv *fdt
{
struct firedtv_receive_context *ctx;
struct fw_device *device = device_of(fdtv);
- char *p;
- int i, j, k, err;
+ int i, err;
ctx = kmalloc(sizeof(*ctx), GFP_KERNEL);
if (!ctx)
@@ -153,11 +153,8 @@ static int start_iso(struct firedtv *fdt
ctx->interrupt_packet = 1;
ctx->current_packet = 0;
- for (i = 0, k = 0; k < N_PAGES; k++) {
- p = kmap(ctx->buffer.pages[k]);
- for (j = 0; j < PACKETS_PER_PAGE && i < N_PACKETS; j++, i++)
- ctx->packets[i] = p + j * MAX_PACKET_SIZE;
- }
+ for (i = 0; i < N_PAGES; i++)
+ ctx->pages[i] = page_address(ctx->buffer.pages[i]);
for (i = 0; i < N_PACKETS; i++) {
err = queue_iso(ctx, i);
--
Stefan Richter
-=====-==--= =-== =--=-
http://arcgraph.de/sr/
next prev parent reply other threads:[~2009-11-18 19:01 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-18 19:00 [PATCH 0/6] DVB: firedtv: simplifications and a portability fix Stefan Richter
2009-11-18 19:00 ` Stefan Richter [this message]
2009-11-18 19:01 ` [PATCH 2/6] firedtv: packet requeuing is likely to succeed Stefan Richter
2009-11-18 19:01 ` [PATCH 3/6] firedtv: remove an unnecessary function argument Stefan Richter
2009-11-18 19:02 ` [PATCH 4/6] firedtv: do not DMA-map stack addresses Stefan Richter
2009-11-18 19:03 ` [PATCH 5/6] firedtv: remove check for interrupting signal Stefan Richter
2009-11-18 19:03 ` [PATCH 6/6] firedtv: reduce memset()s Stefan Richter
2009-11-21 0:26 ` [PATCH 0/6] DVB: firedtv: simplifications and a portability fix Stefan Richter
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=tkrat.6b9442a2f97654ef@s5r6.in-berlin.de \
--to=stefanr@s5r6.in-berlin.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux1394-devel@lists.sourceforge.net \
/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®