linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Ronit Halder <ronit.crj@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com, bp@suse.de,
	dyoung@redhat.com, jroedel@suse.de, krzysiek@podlesie.net,
	msalter@redhat.com, ebiederm@xmission.com,
	akpm@linux-foundation.org, bhe@redhat.com, vgoyal@redhat.com,
	mnfhuang@gmail.com, kexec@lists.infradead.org,
	kirill.shutemov@linux.intel.com, mchehab@osg.samsung.com,
	aarcange@redhat.com, vdavydov@parallels.com,
	dan.j.williams@intel.com, jack@suse.cz, linux-mm@kvack.org,
	Ronit Halder <ronit.crj@gmail.com>
Subject: [RFC 0/4] Kexec: Enable run time memory resrvation of crash kernel
Date: Fri, 12 Aug 2016 19:48:38 +0530	[thread overview]
Message-ID: <20160812141838.5973-1-ronit.crj@gmail.com> (raw)

Currenty linux kernel reserves memory at the boot time for crash kernel.
It will be very useful if we can reserve memory in run time. The user can 
reserve the memory whenerver needed instead of reserving at the boot time.

It is possible to reserve memory for crash kernel at the run time using
CMA (Contiguous Memory Allocator). CMA is capable of allocating big chunk 
of memory. At the boot time we will create one (if only low memory is used)
or two (if we use both high memory in case of x86_64) CMA areas of size 
given in "crashkernel" boot time command line parameter. This memory in CMA
areas can be used as movable pages (used for disk caches, process pages
etc) if not allocated. Then the user can reserve or free memory from those
CMA areas using "/sys/kernel/kexec_crash_size" sysfs entry. If the user
uses high memory it will automatically at least 256MB low memory
(needed for swiotlb and DMA buffers) when the user allocates memory using
mentioned sysfs enrty. In case of high memory reservation the user controls
the size of reserved region in high memory with
"/sys/kernel/kexec_crash_size" entry. If the size set is zero then the 
memory allocated in low memory will automatically be freed.

As the pages under CMA area (when not allocated by CMA) can only be used by
movable pages. The pages won't be used for DMA. So, after allocating pages
from CMA area for loading the crash kernel, there won't be any chance of
DMA on the memory.

Thus is a prototype patch. Please share your opinions on my approach. This
patch is only for x86 and x86_64. Please note, this patch is only a
prototype just to explain my approach and get the review. This patch is on
kernel version v4.4.11.

CMA depends on page migration and only uses movable pages. But, the movable
pages become unmovable momentarily for pinning. The CMA fails for this
reason. I don't have any solution for that right now. This approach will
work when the this problems with CMA will be fixed. The patch is enabled
by a kernel configuration option CONFIG_KEXEC_CMA.

Ronit Halder (4):
  Creating one or two CMA area at Boot time
  Functions for memory reservation and release
  Adding a new kernel configuration to enable the feature
  Enable memory allocation through sysfs interface

 arch/x86/kernel/setup.c | 44 ++++++++++++++++++++++++--
 include/linux/kexec.h   | 11 ++++++-
 kernel/kexec_core.c     | 83 +++++++++++++++++++++++++++++++++++++++++++++++++
 kernel/ksysfs.c         | 23 +++++++++++++-
 mm/Kconfig              |  6 ++++
 5 files changed, 162 insertions(+), 5 deletions(-)

-- 
2.9.0.GIT

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

             reply	other threads:[~2016-08-12 14:19 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-12 14:18 Ronit Halder [this message]
2016-08-12 14:20 ` [RFC 1/4] Creating one or two CMA area at Boot time Ronit Halder
2016-08-12 14:21 ` [RFC 2/4] Functions for memory reservation and release Ronit Halder
2016-08-12 14:25 ` [RFC 3/4] Adding a new kernel configuration to enable the feature Ronit Halder
2016-08-12 14:26 ` [RFC 4/4] Enable memory allocation through sysfs interface Ronit Halder
2016-08-22 10:59 ` [RFC 0/4] Kexec: Enable run time memory resrvation of crash kernel Pratyush Anand
2016-08-23  7:08   ` Xunlei Pang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160812141838.5973-1-ronit.crj@gmail.com \
    --to=ronit.crj@gmail.com \
    --cc=aarcange@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=bhe@redhat.com \
    --cc=bp@suse.de \
    --cc=dan.j.williams@intel.com \
    --cc=dyoung@redhat.com \
    --cc=ebiederm@xmission.com \
    --cc=hpa@zytor.com \
    --cc=jack@suse.cz \
    --cc=jroedel@suse.de \
    --cc=kexec@lists.infradead.org \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=krzysiek@podlesie.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mchehab@osg.samsung.com \
    --cc=mingo@redhat.com \
    --cc=mnfhuang@gmail.com \
    --cc=msalter@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=vdavydov@parallels.com \
    --cc=vgoyal@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).