Ksummit-Discuss Archive on lore.kernel.org
 help / color / Atom feed
* [Ksummit-discuss] [TECH TOPIC] Memory management bits in arch/*
@ 2019-06-17 13:50 Theodore Ts'o
  0 siblings, 0 replies; 2+ messages in thread
From: Theodore Ts'o @ 2019-06-17 13:50 UTC (permalink / raw)
  To: ksummit-discuss

From: Mike Rapoport <rppt@linux.ibm.com>

[ Note: The following abstract was submitted via the Linux Plumbers
  Conference website.  Per the instructions that were posted for the
  Maintainer's / Kernel Summit Call for Proposals[1], the proposal
  should also be posted on the ksummit-discuss list, so that people
  can comment on the proposal, and perhaps start a discussion before
  the summit.

  [1] https://lwn.net/Articles/788378/

  Please note that topic proposals for both the Kernel Summit and the
  Maintainer's Summit are still welcome, although if you submit to the
  Kernel Summit track at this point, please note that you will need to
  have a registration to the Linux Plumbers Conference to attend.  -- Ted ]

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.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Ksummit-discuss] [TECH TOPIC] Memory management bits in arch/*
@ 2019-06-01 19:53 Mike Rapoport
  0 siblings, 0 replies; 2+ messages in thread
From: Mike Rapoport @ 2019-06-01 19:53 UTC (permalink / raw)
  To: ksummit-discuss

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.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-17 13:50 [Ksummit-discuss] [TECH TOPIC] Memory management bits in arch/* Theodore Ts'o
  -- strict thread matches above, loose matches on Subject: below --
2019-06-01 19:53 Mike Rapoport

Ksummit-Discuss Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/ksummit-discuss/0 ksummit-discuss/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ksummit-discuss ksummit-discuss/ https://lore.kernel.org/ksummit-discuss \
		ksummit-discuss@lists.linuxfoundation.org
	public-inbox-index ksummit-discuss

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.linuxfoundation.lists.ksummit-discuss


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git