lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <04a1b98e-efd1-4a77-8f42-7aa5255306b2@redhat.com>
Date: Wed, 7 Aug 2024 12:19:35 +0200
From: David Hildenbrand <david@...hat.com>
To: Barry Song <21cnbao@...il.com>
Cc: akpm@...ux-foundation.org, linux-mm@...ck.org, justinjiang@...o.com,
 chrisl@...nel.org, hughd@...gle.com, kaleshsingh@...gle.com,
 kasong@...cent.com, linux-kernel@...r.kernel.org, ryan.roberts@....com,
 v-songbaohua@...o.com, ying.huang@...el.com
Subject: Re: [PATCH v2 2/2] mm: attempt to batch free swap entries for
 zap_pte_range()

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


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ