Linux Kernel Summit discussions
 help / color / mirror / Atom feed
From: Mike Rapoport <rppt@linux.ibm.com>
To: ksummit-discuss@lists.linuxfoundation.org
Subject: [Ksummit-discuss] [TECH TOPIC] Memory management bits in arch/*
Date: Sat, 1 Jun 2019 22:53:06 +0300	[thread overview]
Message-ID: <20190601195305.GB9609@rapoport-lnx> (raw)

There is a lot of similar and duplicated code in architecture specific bits
of memory management.

For instance, most architectures have

	#define PGALLOC_GFP (GFP_KERNEL | __GFP_ZERO)

for allocating page table pages and many of them use similar, if not
identical, implementation of pte_alloc_one*().

But that's only the tip of the iceberg.

There are several early_alloc() or similarily called routines that do

	if (slab_is_available())
		return kzalloc();
	else
		return memblock_alloc();

Some other trivial examples are free_initmem(), free_initrd_mem() which
were nearly identical accross many architectures until very recently.

More complex cases are per-cpu initialization, passing of memory topology
to the generic MM, reservation of crash kernel, mmap of vdso etc. They are
not really duplicated, but still are very similar in at least several
architectures.

While factoring out the common code is an obvious step to take, I believe
there is also room for refining arch <-> mm interface to avoid adding extra
HAVE_ARCH_NO_BOOTMEM^w^wWHAT_NOT and then searching for the ways to get rid
of them.

-- 
Sincerely yours,
Mike.

             reply	other threads:[~2019-06-01 19:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-01 19:53 Mike Rapoport [this message]
  -- strict thread matches above, loose matches on Subject: below --
2019-06-17 13:50 [Ksummit-discuss] [TECH TOPIC] Memory management bits in arch/* Theodore Ts'o

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=20190601195305.GB9609@rapoport-lnx \
    --to=rppt@linux.ibm.com \
    --cc=ksummit-discuss@lists.linuxfoundation.org \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).