Re: [PATCH v2 2/2] mm: attempt to batch free swap entries for zap_pte_range()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




+     if (!has_cache) {
+             spin_lock(&si->lock);

I'm no expert on that code, but we might drop the cluster lock the take
the swap_info lock and then retake the cluster lock. I assume there are
no races we are worrying about here, right?

I suppose so. Even the original single-entry code follows the same pattern:

static unsigned char __swap_entry_free(struct swap_info_struct *p,
        swp_entry_t entry)
{
          struct swap_cluster_info *ci;
          unsigned long offset = swp_offset(entry);
          unsigned char usage;

          ci = lock_cluster_or_swap_info(p, offset);
          usage = __swap_entry_free_locked(p, offset, 1);
          unlock_cluster_or_swap_info(p, ci);
          if (!usage)
                   free_swap_slot(entry);

          return usage;
}

I assume that once we mark them as SWAP_HAS_CACHE, no one else
will touch them except ourselves.

That makes sense, thanks!

--
Cheers,

David / dhildenb





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux