[haiku-bugs] Re: [Haiku] #10169: Double Fault Exception on usb boot x86_64

  • From: "bonefish" <trac@xxxxxxxxxxxx>
  • Date: Mon, 04 Nov 2013 16:07:30 -0000

#10169: Double Fault Exception on usb boot x86_64
-----------------------------+----------------------------
   Reporter:  korli          |      Owner:  axeld
       Type:  bug            |     Status:  new
   Priority:  normal         |  Milestone:  R1
  Component:  System/Kernel  |    Version:  R1/Development
 Resolution:                 |   Keywords:
 Blocked By:                 |   Blocking:
Has a Patch:  0              |   Platform:  x86-64
-----------------------------+----------------------------

Comment (by bonefish):

 Replying to [comment:3 korli]:
 > Fine. But isn't the 2832 bytes stack usage in
 vm_page_write_modified_page_range() a bit high anyway?

 Yes, that's way too much. The main issue is
 {{{
 PageWriteWrapper* wrappers[maxPages];
 }}}
 With `maxPages` being up to 256, this means 2048 bytes on a 64 bit
 architecture. It should be allocated in the same way `wrapperPool` is
 allocated (i.e. on the heap with small stack array fallback).

 Another issue is the `PageWriteTransfer` object allocated on the stack.
 The class contains the following attribute:
 {{{
 generic_io_vec      fVecs[32]; // TODO: make dynamic/configurable
 }}}
 That's another 512 bytes.

 One can see several heavy stack users in the stack trace. The file cache's
 `read_into_cache()` being the most problematic, since there's no limit for
 nested mounting (e.g. an image file in an image file in an image file
 ...), with certain calls going through as many file cache layers.

 I suppose many functions could use a review wrt stack usage. Even 200
 bytes is quite a bit. And all code that isn't performance critical and is
 allowed to fail could allocate variables on the heap.

--
Ticket URL: <http://dev.haiku-os.org/ticket/10169#comment:4>
Haiku <http://dev.haiku-os.org>
Haiku - the operating system.

Other related posts: