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: <0b478120-1af2-1251-361a-58c30b258ca3@linux.intel.com>
Date:   Tue, 17 Jul 2018 11:27:27 -0700
From:   Dave Hansen <dave.hansen@...ux.intel.com>
To:     "Huang, Ying" <ying.huang@...el.com>,
        Andrew Morton <akpm@...ux-foundation.org>
Cc:     linux-mm@...ck.org, linux-kernel@...r.kernel.org,
        Michal Hocko <mhocko@...e.com>,
        Johannes Weiner <hannes@...xchg.org>,
        Shaohua Li <shli@...nel.org>, Hugh Dickins <hughd@...gle.com>,
        Minchan Kim <minchan@...nel.org>,
        Rik van Riel <riel@...hat.com>,
        Daniel Jordan <daniel.m.jordan@...cle.com>,
        Dan Williams <dan.j.williams@...el.com>
Subject: Re: [PATCH v2 1/7] swap: Add comments to lock_cluster_or_swap_info()

On 07/16/2018 05:55 PM, Huang, Ying wrote:
> +/*
> + * For non-HDD swap devices, the fine grained cluster lock is used to
> + * protect si->swap_map.  But cluster and cluster locks isn't
> + * available for HDD, so coarse grained si->lock will be used instead
> + * for that.
> + */
>  static inline struct swap_cluster_info *lock_cluster_or_swap_info(
>  	struct swap_info_struct *si,
>  	unsigned long offset)

This nomenclature is not consistent with the rest of the file.  We call
a "non-HDD" device an "ssd" absolutely everywhere else in the file.  Why
are you calling it a non-HDD here?  (fwiw, HDD _barely_ hits my acronym
cache anyway).

How about this?

/*
 * Determine the locking method in use for this device.  Return
 * swap_cluster_info if SSD-style cluster-based locking is in place.
 */
static inline struct swap_cluster_info *lock_cluster_or_swap_info(
        struct swap_info_struct *si,
        unsigned long offset)
{
        struct swap_cluster_info *ci;

	/* Try to use fine-grained SSD-style locking if available: */
        ci = lock_cluster(si, offset);

	/* Otherwise, fall back to traditional, coarse locking: */
        if (!ci)
                spin_lock(&si->lock);

        return ci;
}

Which reminds me?  Why do we even bother having two locking models?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ