* "Cannot allocate memory" problem with latest CVS
@ 2002-10-27 18:05 Chris Rankin
2002-10-28 12:08 ` Takashi Iwai
0 siblings, 1 reply; 5+ messages in thread
From: Chris Rankin @ 2002-10-27 18:05 UTC (permalink / raw)
To: alsa-devel
Hi,
The 'cannot allocate memory' problem has returned on
my machine:
$ aplay /usr/lib/sounds/ring.wav
Playing WAVE '/usr/lib/sounds/ring.wav' : Unsigned 8
bit, Rate 22050 Hz, Mono
ALSA lib pcm_hw.c:297:(snd_pcm_hw_hw_params)
SNDRV_PCM_IOCTL_HW_PARAMS failed: Cannot allocate
memory
aplay: set_params:814: Unable to install hw params:
ACCESS: RW_INTERLEAVED
FORMAT: U8
SUBFORMAT: STD
SAMPLE_BITS: 8
FRAME_BITS: 8
CHANNELS: 1
RATE: 22050
PERIOD_TIME: 100000
PERIOD_SIZE: 2205
PERIOD_BYTES: 2205
PERIODS: 5
BUFFER_TIME: 500000
BUFFER_SIZE: 11025
BUFFER_BYTES: 11025
TICK_TIME: 10000
$ aplay /usr/lib/sounds/jungle_exit.wav
Playing WAVE '/usr/lib/sounds/jungle_exit.wav' :
Signed 16 bit Little Endian, Rate 22050 Hz, Stereo
ALSA lib pcm_hw.c:297:(snd_pcm_hw_hw_params)
SNDRV_PCM_IOCTL_HW_PARAMS failed: Cannot allocate
memory
aplay: set_params:814: Unable to install hw params:
ACCESS: RW_INTERLEAVED
FORMAT: S16_LE
SUBFORMAT: STD
SAMPLE_BITS: 16
FRAME_BITS: 32
CHANNELS: 2
RATE: 22050
PERIOD_TIME: 100000
PERIOD_SIZE: 2205
PERIOD_BYTES: 8820
PERIODS: 5
BUFFER_TIME: 500000
BUFFER_SIZE: 11025
BUFFER_BYTES: 44100
TICK_TIME: 10000
$ aplay /usr/lib/sounds/star_trek_6_overture.au
Playing Sparc Audio
'/usr/lib/sounds/star_trek_6_overture.au' : Mu-Law,
Rate 8000 Hz, Mono
ALSA lib pcm_hw.c:297:(snd_pcm_hw_hw_params)
SNDRV_PCM_IOCTL_HW_PARAMS failed: Cannot allocate
memory
aplay: set_params:814: Unable to install hw params:
ACCESS: RW_INTERLEAVED
FORMAT: MU_LAW
SUBFORMAT: STD
SAMPLE_BITS: 8
FRAME_BITS: 8
CHANNELS: 1
RATE: 8000
PERIOD_TIME: 125000
PERIOD_SIZE: 1000
PERIOD_BYTES: 1000
PERIODS: 4
BUFFER_TIME: 500000
BUFFER_SIZE: 4000
BUFFER_BYTES: 4000
TICK_TIME: 10000
$ free -t
total used free shared
buffers cached
Mem: 1033544 1020348 13196 0
30228 748684
-/+ buffers/cache: 241436 792108
Swap: 498004 10668 487336
Total: 1531548 1031016 500532
$ vmstat
procs memory swap
io system cpu
r b w swpd free buff cache si so bi
bo in cs us sy id
2 0 0 10668 13096 30284 748728 0 0 1
3 10 14 97 3 0
I am using the snd-emu10k1 driver with a SB-Live!
card, on a 2.4.19-SMP box with 1 GB memory, so this
out-of-memory error is a bit of a mystery. Are there
any other statistics that would be useful? I expect
(hope!) that this error will disappear soon, so I'd
recommend a swift response, if required.
Cheers,
Chris
__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com
-------------------------------------------------------
This SF.net email is sponsored by: ApacheCon, November 18-21 in
Las Vegas (supported by COMDEX), the only Apache event to be
fully supported by the ASF. http://www.apachecon.com
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: "Cannot allocate memory" problem with latest CVS
2002-10-27 18:05 "Cannot allocate memory" problem with latest CVS Chris Rankin
@ 2002-10-28 12:08 ` Takashi Iwai
2002-10-28 13:21 ` Chris Rankin
0 siblings, 1 reply; 5+ messages in thread
From: Takashi Iwai @ 2002-10-28 12:08 UTC (permalink / raw)
To: Chris Rankin; +Cc: alsa-devel
Hi,
At Sun, 27 Oct 2002 18:05:41 +0000 (GMT),
Chris Rankin wrote:
>
> Hi,
>
> The 'cannot allocate memory' problem has returned on
> my machine:
>
(snip)
>
> $ free -t
> total used free shared
> buffers cached
> Mem: 1033544 1020348 13196 0
> 30228 748684
> -/+ buffers/cache: 241436 792108
> Swap: 498004 10668 487336
> Total: 1531548 1031016 500532
>
>
> $ vmstat
> procs memory swap
> io system cpu
> r b w swpd free buff cache si so bi
> bo in cs us sy id
> 2 0 0 10668 13096 30284 748728 0 0 1
> 3 10 14 97 3 0
>
>
> I am using the snd-emu10k1 driver with a SB-Live!
> card, on a 2.4.19-SMP box with 1 GB memory, so this
> out-of-memory error is a bit of a mystery. Are there
> any other statistics that would be useful? I expect
> (hope!) that this error will disappear soon, so I'd
> recommend a swift response, if required.
i guess actually your box has no free space "for the sb live card".
the emu10k1 chip requires the 29bit PCI DMA mask, and it cannot use
the whole 1GB memory. hence, even if you have memory on the high-mem
region, still this problem may happen.
please note that the current emu10k1 driver allocates pages
dynamically at each pcm playback, while the older version grabbed the
large contiguous area at the module loading time. this makes the
difference of behavior as you found before.
this problem could be solved by using get_free_page() with GFP_KERNEL
(without ATOMIC) like on 2.2 kernels, since pci_alloc_consistent()
uses always GFP_ATOMIC flag so that it can be called from interrupt
handlers. but it would be really a hack...
Takashi
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: "Cannot allocate memory" problem with latest CVS
2002-10-28 12:08 ` Takashi Iwai
@ 2002-10-28 13:21 ` Chris Rankin
2002-10-28 15:15 ` Takashi Iwai
0 siblings, 1 reply; 5+ messages in thread
From: Chris Rankin @ 2002-10-28 13:21 UTC (permalink / raw)
To: Takashi Iwai; +Cc: alsa-devel
Ouch. This means that this problem will always appear
eventually, and the only way to clear it is waiting
for Linux to free a large amount of cache memory.
<flamebait>Or I could reboot my machine.</flamebait>
In the meantime, I have no PCM playback via my
SB-Live!. Is this a 2.4 or a SB-Live limitation?
Chris
--- Takashi Iwai <tiwai@suse.de> wrote: > Hi,
>
> At Sun, 27 Oct 2002 18:05:41 +0000 (GMT),
> Chris Rankin wrote:
> >
> > Hi,
> >
> > The 'cannot allocate memory' problem has returned
> on
> > my machine:
> >
> (snip)
> >
> > $ free -t
> > total used free
> shared
> > buffers cached
> > Mem: 1033544 1020348 13196
> 0
> > 30228 748684
> > -/+ buffers/cache: 241436 792108
> > Swap: 498004 10668 487336
> > Total: 1531548 1031016 500532
> >
> >
> > $ vmstat
> > procs memory swap
>
> > io system cpu
> > r b w swpd free buff cache si so
> bi
> > bo in cs us sy id
> > 2 0 0 10668 13096 30284 748728 0 0
> 1
> > 3 10 14 97 3 0
> >
> >
> > I am using the snd-emu10k1 driver with a SB-Live!
> > card, on a 2.4.19-SMP box with 1 GB memory, so
> this
> > out-of-memory error is a bit of a mystery. Are
> there
> > any other statistics that would be useful? I
> expect
> > (hope!) that this error will disappear soon, so
> I'd
> > recommend a swift response, if required.
>
> i guess actually your box has no free space "for the
> sb live card".
> the emu10k1 chip requires the 29bit PCI DMA mask,
> and it cannot use
> the whole 1GB memory. hence, even if you have
> memory on the high-mem
> region, still this problem may happen.
>
> please note that the current emu10k1 driver
> allocates pages
> dynamically at each pcm playback, while the older
> version grabbed the
> large contiguous area at the module loading time.
> this makes the
> difference of behavior as you found before.
>
> this problem could be solved by using
> get_free_page() with GFP_KERNEL
> (without ATOMIC) like on 2.2 kernels, since
> pci_alloc_consistent()
> uses always GFP_ATOMIC flag so that it can be called
> from interrupt
> handlers. but it would be really a hack...
>
>
> Takashi
__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: "Cannot allocate memory" problem with latest CVS
2002-10-28 13:21 ` Chris Rankin
@ 2002-10-28 15:15 ` Takashi Iwai
2002-10-28 20:26 ` Chris Rankin
0 siblings, 1 reply; 5+ messages in thread
From: Takashi Iwai @ 2002-10-28 15:15 UTC (permalink / raw)
To: Chris Rankin; +Cc: alsa-devel
[-- Attachment #1: Type: text/plain, Size: 515 bytes --]
At Mon, 28 Oct 2002 13:21:48 +0000 (GMT),
Chris Rankin wrote:
>
> Ouch. This means that this problem will always appear
> eventually, and the only way to clear it is waiting
> for Linux to free a large amount of cache memory.
> <flamebait>Or I could reboot my machine.</flamebait>
could you try the attached patch?
as mentioned in my previous mail, this is really a hack, but if it
works...
> In the meantime, I have no PCM playback via my
> SB-Live!. Is this a 2.4 or a SB-Live limitation?
both :)
Takashi
[-- Attachment #2: sgbuf-getpage.dif --]
[-- Type: application/octet-stream, Size: 1211 bytes --]
Index: alsa-kernel/core/pcm_sgbuf.c
===================================================================
RCS file: /suse/tiwai/cvs/alsa/alsa-kernel/core/pcm_sgbuf.c,v
retrieving revision 1.7
diff -u -r1.7 pcm_sgbuf.c
--- alsa-kernel/core/pcm_sgbuf.c 10 Sep 2002 10:20:00 -0000 1.7
+++ alsa-kernel/core/pcm_sgbuf.c 28 Oct 2002 14:35:43 -0000
@@ -128,7 +128,32 @@
while (sgbuf->pages < pages) {
void *ptr;
dma_addr_t addr;
+#ifdef __i386__
+ /* HACK! we try to allocate with GFP_KERNEL */
+ unsigned long rmask;
+ if (sgbuf->pci)
+ rmask = ~(unsigned long)sgbuf->pci->dma_mask;
+ else
+ rmask = 0;
+ ptr = (void *)__get_free_pages(GFP_KERNEL, 1);
+ if (ptr) {
+ addr = virt_to_phys(ptr);
+ if (((unsigned long)addr + PAGE_SIZE - 1) & rmask) {
+ /* reallocate with the proper mask */
+ free_pages((unsigned long)ptr, PAGE_SIZE);
+ ptr = (void *)__get_free_pages(GFP_KERNEL | GFP_DMA, 1);
+ if (ptr)
+ addr = virt_to_phys(ptr);
+ else
+ addr = 0;
+ }
+ } else
+ addr = 0;
+ if (ptr)
+ memset(ptr, 0, PAGE_SIZE);
+#else
ptr = snd_malloc_pci_pages(sgbuf->pci, PAGE_SIZE, &addr);
+#endif
if (! ptr)
return -ENOMEM;
sgbuf->table[sgbuf->pages].buf = ptr;
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: "Cannot allocate memory" problem with latest CVS
2002-10-28 15:15 ` Takashi Iwai
@ 2002-10-28 20:26 ` Chris Rankin
0 siblings, 0 replies; 5+ messages in thread
From: Chris Rankin @ 2002-10-28 20:26 UTC (permalink / raw)
To: Takashi Iwai; +Cc: alsa-devel
--- Takashi Iwai <tiwai@suse.de> wrote: > At Mon, 28
Oct 2002 13:21:48 +0000 (GMT),
> could you try the attached patch?
> as mentioned in my previous mail, this is really a
> hack, but if it
> works...
My box has obviously released some memory overnight
and is working again. I'll try the patch as soon as
the problem reoccurs.
Cheers,
Chris
__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2002-10-28 20:26 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-10-27 18:05 "Cannot allocate memory" problem with latest CVS Chris Rankin
2002-10-28 12:08 ` Takashi Iwai
2002-10-28 13:21 ` Chris Rankin
2002-10-28 15:15 ` Takashi Iwai
2002-10-28 20:26 ` Chris Rankin
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.