lkml.org 
[lkml]   [2005]   [Aug]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH] struct file cleanup : the very large file_ra_state is now allocated only on demand.
From
From: Andi Kleen <ak@suse.de>
Date: Thu, 18 Aug 2005 03:05:25 +0200

> I would just set the ra pointer to a single global structure if the
> allocation fails. Then you can avoid all the other checks. It will
> slow down things and trash some state, but not fail and nobody
> should expect good performance after out of memory anyways. The only
> check still needed would be on freeing.

I would think twice about that due to repeatability concerns. Yes, we
should care less when memory is so low, but if we can avoid this kind
of scenerio easily we should.

Having said that, I would like to recommend looking into a scheme
where the path leading to the filp allocation states whether the
read-ahead bits are needed or not. This has two benefits:

1) Repeatability, and error signalling at the correct place
should the memory allocation fail.

2) We can avoid the pointer dereference overhead. The read-ahead
state is always at (filp + 1). Macro'ized or static inline
function'ized interfaces for this access can make it look
clean and perhaps even implement debugging of the case where
we try to get at the read-ahead state for a non-read-ahead
filp.

I do really think that would be a better approach. A quick glance
shows that it should be easy to propagate the "need_read_ahead"
state, just by passing a boolean to get_unused_fd() via
sock_map_fd().
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-08-18 04:46    [W:0.103 / U:0.192 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site