Messages in this thread | | | Subject | Re: [RFC] per thread page reservation patch | From | Nikita Danilov <> | Date | Sat, 08 Jan 2005 01:12:28 +0300 |
| |
Andrew Morton <akpm@osdl.org> writes:
[...]
> > Maybe I'm being thick, but I don't see how you can protect the reservation > of an outer reserver in the above way: > > perthread_pages_reserve(10); > ... /* current->private_pages_count = 10 */ > perthread_pages_reserve(10) /* private_pages_count = 20 */ > use 5 pages /* private_pages_count = 15 */ > perthread_pages_release(5); > > But how does the caller come up with the final "5"?
wasreserved = perthread_pages_count(); result = perthread_pages_reserve(estimate_reserve(), GFP_KERNEL); if (result != 0) return result;
/* do something that consumes reservation */
perthread_pages_release(perthread_pages_count() - wasreserved);
> > Seems better to me if prethread_pages_reserve() were to return the initial > value of private_pages_count, so the caller can do: > > old = perthread_pages_reserve(10); > use 5 pages > perthread_pages_release(old); > > or whatever. > > That kinda stinks too in a way, because both the outer and the inner > callers need to overallocate pages on behalf of the worst case user in some > deep call stack. > > And the whole idea is pretty flaky really - how can one precalculate how > much memory an arbitrary md-on-dm-on-loop-on-md-on-NBD stack will want to > use? It really would be better if we could drop the whole patch and make > reiser4 behave more sanely when its writepage is called with for_reclaim=1.
Reiser4 doesn't use this for ->writepage(), by the way. This is used by tree balancing code to assure that balancing cannot get -ENOMEM in the middle of tree modification, because undo is _so_ very complicated.
Nikita. - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |