From mboxrd@z Thu Jan 1 00:00:00 1970 Date: Mon, 22 Aug 2005 06:23:33 -0700 (PDT) From: Christoph Lameter Subject: Re: [PATCH] Use deltas to replace atomic inc In-Reply-To: Message-ID: References: <20050817151723.48c948c7.akpm@osdl.org> <20050817174359.0efc7a6a.akpm@osdl.org> <20050818212939.7dca44c3.akpm@osdl.org> <20050820005843.21ba4d9b.akpm@osdl.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-linux-mm@kvack.org Return-Path: To: Linus Torvalds Cc: Andrew Morton , hugh@veritas.com, nickpiggin@yahoo.com.au, linux-mm@kvack.org List-ID: On Sun, 21 Aug 2005, Linus Torvalds wrote: > On Sun, 21 Aug 2005, Christoph Lameter wrote: > > > > > > Why? I don't think it's ever wrong to do the thing. We should be holding > > > no locks at the point (and we haven't grabbed he RQ lock yet), so it > > > should always be safe to get the page table lock. > > > > get_user_pages and unuse_mm may be working on an mm that is not > > current->mm. If schedule is called then the deltas are added to the wrong > > mm (current->mm). > > Hmm. But we already hold (and _have_ to hold) the mm lock there, don't we? We drop the lock for allocations. At that point schedule() may be called. > Why not make the rule be that we only use the delta stuff when we don't > hold the mm lock. Which is pretty seldom, but the big one is obviously > anon page faults. Yes I have tried to follow that. But there are some functions that are called from both contexts. Most importantly this is page_add_anon_rmap. If we would remove incrementing anon_rss from the function then we can at avoid the problem for the unuse_mm path. But we would still have the issue with handle_mm_fault. So we would still need some flag. > Whenever we already -do- hold the page table lock for other reasons, > there's no actual upside to using the delta representation. In fact, > there's only downsides, since it just makes the things like scheduling > slower. There is a slight benefit in avoiding additional writes to mm_struct which limits cacheline bouncing during heavy contention. -- 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: email@kvack.org