Re: mm/page_alloc.c low_on_memory variable.

Stephen C. Tweedie (sct@redhat.com)
Tue, 20 Apr 1999 23:52:56 +0100 (BST)


Hi,

On Fri, 16 Apr 1999 19:35:58 -0400 (EDT), "Richard B. Johnson"
<root@chaos.analogic.com> said:

> Hello mm gurus,

> In page_alloc.c, defined in /include/linux/mm.h, is this wonderful
> global variable that I'd love to see from a driver module. Unfortunately,
> even though it is global, it is somehow invisible. It becomes an undefined
> symbol if I attempt to use it in my module.

That is because it is not an "exported" symbol. Modules cannot access
it: all modules have to use the exported interface.

> The driver that I am implementing should not have a fixed amount of pages
> that it can use because it should be able to use more if there is more
> memory available and less if less.

It really should just allocate a fixed size, selectable by the user. It
sounds as if your driver allocates these pages on demand but doesn't
release them on demand, and that's bad behaviour in the Unix environment.

> Presently, if I allocate pages to buffer an incomming data stream, and
> using failure to obtain a free page as a throttle, it is way too late.
> The machine will die a horrible death with out-of-memory errors for
> everything including init. So I have to be able to check something
> before I attempt to allocate another page.

Trouble is, even if there _is_ lots of memory available at the time the
driver loads, the user or admin may be wanting to use it for something
else. You simply can't let a driver gobble up all "available" memory on
the assumption that nobody else will want to use it. Using a sane
default buffer size and letting the user specify a larger buffer when
the driver is loaded makes much more sense.

Cheers,
Stephen

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/