Leatherface75 / vtuner

Automatically exported from code.google.com/p/vtuner
0 stars 0 forks source link

page allocation failure #31

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Build latest version of vtuner apps, install vtunerd on TBS MOI
2. Build latest version of vtunerc kernel module on recent kernel (ex: 3.8.6)
3. Stream video for several hours

What is the expected output? What do you see instead?
  After several hours the data copy thread of vtunerc is terminated by the kernel:

   vtunerc.x86_64: page allocation failure: order:4, mode:0x1040d0
   Pid: 1760, comm: vtunerc.x86_64 Tainted: GF          O 3.9.0-rc6 #1
   Call Trace:
    [<ffffffff81138429>] warn_alloc_failed+0xe9/0x150
    [<ffffffff816567c8>] ? __alloc_pages_direct_compact+0x182/0x194
    [<ffffffff8113c2f4>] __alloc_pages_nodemask+0x844/0xac0
    [<ffffffff81179258>] alloc_pages_current+0xb8/0x190
    [<ffffffff81137424>] __get_free_pages+0x14/0x50
    [<ffffffff811847f9>] kmalloc_order_trace+0x39/0xb0
    [<ffffffff81184a5d>] __kmalloc+0x1ed/0x210
    [<ffffffffa0596763>] vtunerc_ctrldev_write+0x83/0x240 [vtunerc]
    [<ffffffff8119bcfc>] vfs_write+0xac/0x180
    [<ffffffff8119c192>] sys_write+0x52/0xa0
    [<ffffffff81660579>] ? do_device_not_available+0x19/0x20
    [<ffffffff81667b59>] system_call_fastpath+0x16/0x1b

What version of the product are you using? On what operating system?

  Latest versions of vtuner apps, and vtuner linux-driver.
  Failure occurs on recent kernels such as 3.8.6 and 3.9-rc6.
  Failure does not occur on older kernels such as 3.4.39.

Please provide any additional information below.

  The vtunerc kernel module uses kalloc() to allocate a kernel buffer, then kfree()
  to free the buffer for each call to vtunerc_ctrldev_write().
  After many thousands of iterations the memory becomes fragmented, and the
  buffer can no longer be allocated.

  This problem was reported in dvbhdhomerun, see here:

     http://sourceforge.net/p/dvbhdhomerun/discussion/1223414/thread/6070e0fa/

  Version 0.15 of dvbhdhomerun was created to solve this problem.
  The new version of dvbhdhomerun works around the memory fragmentation problem
  by allocating the buffer once (one buffer for each device), then re-using
  the same buffer.  The buffer is only re-allocated if the write size is increased.

  Here are the diffs to dvbhdhomerun:

    http://dvbhdhomerun.cvs.sourceforge.net/viewvc/dvbhdhomerun/dvbhdhomerun/kernel/dvb_hdhomerun_data.c?r1=1.3&r2=1.4

  I have made similar changes to the vtunerc module.
  I have attached a new vtuner_ctrldev.c, vtuner_main.c and vtuner_priv.h
  in case you would like to add these changes to the repository.
  After making these changes to the vtunerc module the vtunerc application
  no longer dies.

Original issue reported on code.google.com by will.scales@gmail.com on 14 Apr 2013 at 12:02

Attachments:

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Nice contribution, thanks!

Already applied for driver version 1.4.

Original comment by jpetrous on 18 Apr 2013 at 9:26