7

When I see that phrase (or similar), as e.g. today in How to Use the free Command on Linux (article with 2020 date):

RAM that isn’t being used for something is wasted RAM

I recall about LPDDR used for mobile devices:

Additional savings come from temperature-compensated refresh (DRAM requires refresh less often at low temperatures), partial array self refresh, and a "deep power down" mode which sacrifices all memory contents.

As Android is based on Linux kernel, does it already supports putting part of memory in "deep power down"? Some kernel parameters to enable managing data in a way to minimize total memory usage?

In total: has Linux kernel abandoned universally applying "RAM that isn’t being used for something is wasted RAM" approach?

5
  • Wouldn't deep power down apply to a whole DIMM? With dual-channel memory with the memory controller interleaving between DIMMs to increase bandwidth, powering down a DIMM would lose every other cache line in every page. Maybe you could use a different interleave strategy, coarser which wouldn't help as much with bandwidth for a single stream... Dec 24, 2021 at 22:40
  • 2
    What is meant by "wasted"? As in a waste of electricity if it's not going to be used by the system, or a waste of money to have if it won't be used?
    – cat
    Dec 24, 2021 at 23:03
  • @PeterCordes, doesn't dual-channel pairs modules, so that a pair can be powered down? I'm not sure I understand properly yours: "would lose every other cache line in every page" - like every page in the whole system or on that DIMM? Dec 24, 2021 at 23:47
  • 1
    @cat: It is wasted because it carries an opportunity cost, which may in some cases be low but will almost always be nonzero.
    – Kevin
    Dec 25, 2021 at 5:06
  • Prompt reaction to the question hints on importance of wording. My previous one on the same subject got lost w/out answers. unix.stackexchange.com/questions/678980/…. I think I try to vote previous as duplicate. Though it is for a different angle... Dec 29, 2021 at 2:32

1 Answer 1

13

Has Linux kernel abandoned universally applying "RAM that isn’t being used for something is wasted RAM" approach?

No, it hasn’t: it is still the case that the kernel will not try to avoid using memory which is available. However, it supports memory hotplug, which could conceivably be paired with features such as those offered by LPDDR to reduce power consumption: a given memory chip could be relinquished, hot-“unplugged”, and powered down.

Whether all that would actually result in reduced power consumption overall is a whole other debate.

12
  • Thank you for quick and at first glance close to complete answer. You have noted "universally" is the question? If yes, does your answer mean kernel supports, but never recommends? One of uses in the document is stated as: "Reducing energy consumption" II ) I've read most of the document, tried to put some offline, got busy - in short: do you advice to ask additional questions on the hotplug as 1) comments here, 2) expanding the question, 3) creating other questions? Dec 24, 2021 at 12:38
  • I've found unix.stackexchange.com/questions/312312/… where a person have not got answer how to use the feature to reduce memory for VM - same as me "busy" - any pointers how to unplug in practice? Dec 24, 2021 at 12:45
  • Yes, I had noticed the use of “universally” in the question. The kernel always tries to use all available memory, or rather, it doesn’t try to avoid using all available memory; but it also supports changes to available memory at runtime. The usual rules regarding questions apply here: questions which arise from an answer should be asked as new questions, with context. This Q&A does have answers; the first one provides an important hint: you need to prepare your system to allow memory hot-unplugging, it won’t work with a default setup. Dec 24, 2021 at 13:09
  • 2
    @Jeff I’m trying to distinguish between “actively tries to use all available memory” and “doesn’t use more memory than it needs, but doesn’t put huge effort into curtailing its use of memory”. Dec 24, 2021 at 13:25
  • 1
    The default setup should minimise surprises. If the kernel tries to reserve memory for movable zones, it’s bound to get it wrong in some cases, which would lead to obscure and hard-to-diagnose errors. With the current situation, the default setup works for everyone who doesn’t need memory hotplugging, which is most users of non-specific systems. Designers of systems where hotplugging is helpful (including phones, perhaps) know this, and can adjust settings as appropriate. Dec 24, 2021 at 13:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.