kmap_kiobuf()
Quoted 13 lines
Hi,
Quoted 4 lines · On Wed, Jun 28, 2000 at 10:54:40AM -0500, [email protected] wrote:
I always knew it would go down like a ton of bricks, because of the TLB flushing costs. As soon as you have a multi-cpu box this operation gets expensive, the code could be changed to do lazy tlb flushes on unmapping the pages, but you still have the cost every time you set a mapping up.
That's exactly what
kmap()is for --- it does all the lazy tlb flushing for you. Of course, the kmap area can get fragmented so it's not a magic solution if you really need contiguous virtual mappings.
Quoted 7 lines
However, kmap caches the virtual mappings for you automatically, so it may well be fast enough for you that you can avoid the whole contiguous map thing and just kmap pages as you need them. Is that impossible for your code?
Cheers,
Stephen
Hmm, not sure how much kmap helps - it appears to be for mapping a single page from highmem. The issue with XFS is that we have variable sized chunks of meta-data (could be upto 64 Kbytes depending on how the filesystem was built).
The code was originally written to treat this like a byte array. Some of the structures are layed out so that we could rework the code to not treat it as a byte array, since they are basically arrays of smaller records. Some are run length encoded type structures (directory leaf blocks being one) where reworking the code would be a pain to say the least.
So we are currently using memory managed as an address space to do the caching of metadata. Everything is built up out of single pages, and when we need something bigger we glue it together into a larger chunk of address space. This has the nice property that for cached metadata which does not have special properties at the moment, we can just leave the pages in the address space. The rest of the vm system is then free to reuse them out from under us when there is demand for more memory.
Clearly it also has the nasty property of wanting to mess with the address space map on a regular basis. [ Note that the mapping together of pages like this is only done when the caller requests it, we can still use pagebufs without it. ]
So if we do not use pages then we could use other memory from the slab allocator, and work really hard to ensure it always works. If we go this route then we now have chunks memory which we need to manage as our own cache, otherwise we end up continually re-reading from disk. We introduce another caching mechanism into the kernel - yet another beast to fight over memory.
If we do not allow the remapping of the pages then we get into rewriting lots of XFS, and almost certainly breaking it in the process.
Ben mentioned large page support as another way to get around this problem. Where is that in the grand scheme of things?
Steve
p.s. Woudn't the remapping of pages be a way to let modules etc get larger arrays of memory after boot time - doing it a few times is not going to kill the system.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux.eu.org/Linux-MM/
On Wed, 28 Jun 2000 [email protected] wrote:
...
Quoted 2 lines
Ben mentioned large page support as another way to get around this problem. Where is that in the grand scheme of things?
...
For filesystems, I meant increasing PAGE_CACHE_SIZE. I'm planning on getting this working for 2.5.early. Of course, this will put more pressure on the memory allocator which means that it will have to go along with zoning changes.
Large page support will be a somewhat different beast: using 4MB pages (on x86) for mapping/io purposes. The idea there is that the individual pages would still be put into the page cache, but they would be marked with a flag as part of a large page (should be fairly similar to how other unices implement it). It's really only relevant to the mm subsystem and the tlb's on machines that support varying page sizes.
Quoted 3 lines
p.s. Woudn't the remapping of pages be a way to let modules etc get larger arrays of memory after boot time - doing it a few times is not going to kill the system.
Hrm? Allocating physically contiguous memory is a problem that requires big changes to the allocator and the swapper. Sure, once we get these fixed, all sorts of things become possible. But this doesn't help with the fact that kernel mappings for objects larger than a single page just aren't possible right now. Hmm. How bad would supporting a small number of fixed higher-order kmaps be? (and what's Linus' opinion on such a change?)
-ben
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux.eu.org/Linux-MM/
Hi,
Quoted 4 lines · On Wed, Jun 28, 2000 at 03:16:42PM -0500, [email protected] wrote:
So we are currently using memory managed as an address space to do the caching of metadata. Everything is built up out of single pages, and when we need something bigger we glue it together into a larger chunk of address space.
What do you mean by "address space"? If you mean kernel VA, then there's a clear risk of fragmenting the kernel's remappable area and ending up unable to find contiguous regions at all if you're not careful.
Quoted 3 lines
p.s. Woudn't the remapping of pages be a way to let modules etc get larger arrays of memory after boot time - doing it a few times is not going to kill the system.
That's what vmalloc does. If you mean actually moving physical pages to clear space, it's really not so simple --- what happens if you encounter mlock()ed pages? The kernel also mixes user pages with pinned kernel data structures which simply cannot be moved, so it's not straightforward to support that sort of thing.
Cheers,
Stephen
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux.eu.org/Linux-MM/
Quoted 6 lines
Hi,
Quoted 2 lines · On Wed, Jun 28, 2000 at 03:16:42PM -0500, [email protected] wrote:
So we are currently using memory managed as an address space to do the caching of metadata. Everything is built up out of single pages, and when w
e
Quoted 7 lines
Quoted 2 lines
need something bigger we glue it together into a larger chunk of address space.
What do you mean by "address space"? If you mean kernel VA, then there's a clear risk of fragmenting the kernel's remappable area and ending up unable to find contiguous regions at all if you're not careful.
Sorry, I used the same term for two different things there, we cache meta data in a 'struct address_space', the second one is the problem issue. XFS is doing 'bad things' with address space remapping to take a handful of previously existing pages and remapping them to appear as one chunk of memory. We do not usually have that many in existence at once. I think it has pretty much been established that this is not going to be acceptable in the long term - I always knew that was likely.
Running with a bigger PAGE_CACHE_SIZE will help, some of the code in XFS may be changable to work without treating the metadata object as a single chunk of memory, and we may be able to come up with some other tricks too.
Steve
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux.eu.org/Linux-MM/