linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* spin_lock(&zone->lock)
@ 2000-08-18 19:34 Timur Tabi
  0 siblings, 0 replies; only message in thread
From: Timur Tabi @ 2000-08-18 19:34 UTC (permalink / raw)
  To: Linux MM mailing list

I have this code in my driver (truncataed for clarity):

    unsigned order;  // set to whatever order you want
    zone_t *zone = contig_page_data.node_zones + ZONE_NORMAL;                  
// Get the zone pointer

    free_area_t *area = zone->free_area+order;                           //
area contains the list_head and map bitmap
    struct list_head *list = &area->free_list;                           //
list contains the head of the mem_map_t linked list
    mem_map_t *mm = (mem_map_t *) list->next;                                  
// get the head of the mem_map_t linked list

    spin_lock(&zone->lock);
    list_del(&mm->list);                                        // yes, so
delete it from the list
    list_add(&mm->list, list);                                  // and add it
back. This moves it to the head
    spin_unlock(&zone->lock);

Will the spinlock effectively protect the linked list in the mm structure from
being modified by another thread?  Is the 2.4 kernel even re-entrant on an SMP
system?  Last I heard, it wasn't, so this spinlock is probably unnecessary.  I
had only one operating system class in college, so I always have a hard time
fully understand spinlocks and stuff like that.



--
Timur Tabi - ttabi@interactivesi.com
Interactive Silicon - http://www.interactivesi.com

When replying to a mailing-list message, please don't cc: me, because then I'll just get two copies of the same message.
--
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.eu.org/Linux-MM/

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2000-08-18 19:34 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-08-18 19:34 spin_lock(&zone->lock) Timur Tabi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox