[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJZ5v0iJksVhrWwOCaSfg1HcmtTVTKAmF04iKuMvyO6vjm5rnA@mail.gmail.com>
Date: Tue, 7 Jan 2020 11:04:43 +0100
From: "Rafael J. Wysocki" <rafael@...nel.org>
To: Michal Hocko <mhocko@...nel.org>
Cc: Luigi Semenzato <semenzato@...gle.com>,
Linux Memory Management List <linux-mm@...ck.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
"Rafael J. Wysocki" <rafael@...nel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Geoff Pike <gpike@...gle.com>
Subject: Re: [PATCH 1/2] Documentation: clarify limitations of hibernation
On Mon, Jan 6, 2020 at 1:53 PM Michal Hocko <mhocko@...nel.org> wrote:
>
> On Thu 26-12-19 14:02:04, Luigi Semenzato wrote:
> [...]
> > +Limitations of Hibernation
> > +==========================
> > +
> > +When entering hibernation, the kernel tries to allocate a chunk of memory large
> > +enough to contain a copy of all pages in use, to use it for the system
> > +snapshot. If the allocation fails, the system cannot hibernate and the
> > +operation fails with ENOMEM. This will happen, for instance, when the total
> > +amount of anonymous pages (process data) exceeds 1/2 of total RAM.
> > +
> > +One possible workaround (besides terminating enough processes) is to force
> > +excess anonymous pages out to swap before hibernating. This can be achieved
> > +with memcgroups, by lowering memory usage limits with ``echo <new limit> >
> > +/dev/cgroup/memory/<group>/memory.mem.usage_in_bytes``. However, the latter
> > +operation is not guaranteed to succeed.
>
> I am not familiar with the hibernation process much. But what prevents
> those allocations to reclaim memory and push out the anonymous memory to
> the swap on demand during the hibernation's allocations?
Nothing in particular AFAICS, at least in theory.
The approach taken by the hibernation code is rather straightforward:
allocate enough memory to store a copy of every page (in RAM) that
needs to be saved. These allocations are made one page at a time, so
in theory they should not fail as long as there is enough swap space
in the system, but I'm probably missing something here.
Powered by blists - more mailing lists