[svn-commits] sruffell: branch linux/2.2 r7683 - in /linux/branches/2.2: ./ drivers/dahdi/
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Fri Dec 11 17:20:38 CST 2009
Author: sruffell
Date: Fri Dec 11 17:20:35 2009
New Revision: 7683
URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=7683
Log:
Merged revisions 7681 via svnmerge from
https://origsvn.digium.com/svn/dahdi/linux/trunk
........
r7681 | sruffell | 2009-12-11 17:20:02 -0600 (Fri, 11 Dec 2009) | 6 lines
dahdi-base: Reduce the max allocation size in dahdi_reallocbufs.
Lower the maximum contiguous chunk that DAHDI asks for from
DAHDI_MAX_BUFFER_SIZE*2 to DAHDI_MAX_BUFFER_SIZE. With 4K pages, this can allow
the kernel to try a little harder to find the memory it needs since the request
goes from order 4 to order 3.
........
Modified:
linux/branches/2.2/ (props changed)
linux/branches/2.2/drivers/dahdi/dahdi-base.c
Propchange: linux/branches/2.2/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.
Modified: linux/branches/2.2/drivers/dahdi/dahdi-base.c
URL: http://svnview.digium.com/svn/dahdi/linux/branches/2.2/drivers/dahdi/dahdi-base.c?view=diff&rev=7683&r1=7682&r2=7683
==============================================================================
--- linux/branches/2.2/drivers/dahdi/dahdi-base.c (original)
+++ linux/branches/2.2/drivers/dahdi/dahdi-base.c Fri Dec 11 17:20:35 2009
@@ -897,9 +897,12 @@
data[len - 1] = (fcs >> 8) & 0xff;
}
-static int dahdi_reallocbufs(struct dahdi_chan *ss, int j, int numbufs)
-{
- unsigned char *newbuf, *oldbuf;
+static int dahdi_reallocbufs(struct dahdi_chan *ss, int blocksize, int numbufs)
+{
+ unsigned char *newtxbuf = NULL;
+ unsigned char *newrxbuf = NULL;
+ unsigned char *oldtxbuf = NULL;
+ unsigned char *oldrxbuf = NULL;
unsigned long flags;
int x;
@@ -911,25 +914,32 @@
numbufs = DAHDI_MAX_NUM_BUFS;
/* We need to allocate our buffers now */
- if (j) {
- if (!(newbuf = kcalloc(j * 2, numbufs, GFP_KERNEL)))
+ if (blocksize) {
+ newtxbuf = kzalloc(blocksize * numbufs, GFP_KERNEL);
+ if (NULL == newtxbuf)
return -ENOMEM;
- } else
- newbuf = NULL;
-
- /* Now that we've allocated our new buffer, we can safely
+ newrxbuf = kzalloc(blocksize * numbufs, GFP_KERNEL);
+ if (NULL == newrxbuf) {
+ kfree(newtxbuf);
+ return -ENOMEM;
+ }
+ }
+
+ /* Now that we've allocated our new buffers, we can safely
move things around... */
spin_lock_irqsave(&ss->lock, flags);
- ss->blocksize = j; /* set the blocksize */
- oldbuf = ss->readbuf[0]; /* Keep track of the old buffer */
+ ss->blocksize = blocksize; /* set the blocksize */
+ oldrxbuf = ss->readbuf[0]; /* Keep track of the old buffer */
+ oldtxbuf = ss->writebuf[0];
ss->readbuf[0] = NULL;
- if (newbuf) {
+ if (newrxbuf) {
+ BUG_ON(NULL == newtxbuf);
for (x = 0; x < numbufs; x++) {
- ss->readbuf[x] = newbuf + x * j;
- ss->writebuf[x] = newbuf + (numbufs + x) * j;
+ ss->readbuf[x] = newrxbuf + x * blocksize;
+ ss->writebuf[x] = newtxbuf + x * blocksize;
}
} else {
for (x = 0; x < numbufs; x++) {
@@ -948,7 +958,7 @@
/* Keep track of where our data goes (if it goes
anywhere at all) */
- if (newbuf) {
+ if (newrxbuf) {
ss->inreadbuf = 0;
ss->inwritebuf = 0;
} else {
@@ -972,8 +982,8 @@
spin_unlock_irqrestore(&ss->lock, flags);
- if (oldbuf)
- kfree(oldbuf);
+ kfree(oldtxbuf);
+ kfree(oldrxbuf);
return 0;
}
More information about the svn-commits
mailing list