lkml.org 
[lkml]   [2004]   [Jun]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] mm lock ordering summary
On Fri, 25 Jun 2004, Andrew Morton wrote:
>
> Yes, but what does
>
> a
> b
> c
> d
>
> mean?
>
> The above graph tells us that one or more of (swap_device_lock,
> mapping->private_lock and inode_lock) nests inside one or more of
> (swap_list_lock, zone->lru_lock and page->flags PG_maplock).

Yes. I think I ordered it so that it meant c and d nest inside b,
and a's a leaf of less interest; but of course it's just good luck
if any such ordering is possible.

> And has no way of telling us _where_, say, swap_device_lock nests inside
> zone->lru_lock.

Hence the comments, or search the source: this is only a summary.

> And it alleges that tree_lock nests inside lru_lock, which isn't so. Is
> it? These guys used to have no locking relationship. Hopefully that's
> still the case. But how to represent that?

It's alleging that you'll be okay if you write code with tree_lock
nesting inside lru_lock, and you need to worry if you do the reverse.

How is this summary used? I use it to check whether I've got my locks
in the right order. Look at the summary and if what I've written fits
with the sequence shown, I'm okay. If not, I need to enquire further:
think about changing around my new code to fit the ordering shown; if
that's difficult then look through the source to find where those rules
come from, think about changing them around; or, complicate (refine?)
the summary to show that actually my new case is not a problem after all.

I'm suggesting it be a checklist, rather than a declaration of truth:
easier to maintain the checklist. But I doubt I'm persuading you:
please add page_map_lock and anon_vma->lock (but where and how many?).

Hugh

-
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/

\
 
 \ /
  Last update: 2005-03-22 14:04    [W:0.120 / U:0.124 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site