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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <m24ne43u5c.fsf@firstfloor.org>
Date:	Wed, 15 May 2013 12:44:31 -0700
From:	Andi Kleen <andi@...stfloor.org>
To:	Mel Gorman <mgorman@...e.de>
Cc:	Linux-MM <linux-mm@...ck.org>,
	Johannes Weiner <hannes@...xchg.org>,
	Dave Hansen <dave@...1.net>, Christoph Lameter <cl@...ux.com>,
	LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 18/22] mm: page allocator: Split magazine lock in two to reduce contention

Mel Gorman <mgorman@...e.de> writes:
>  
> -static inline struct free_area_magazine *find_lock_filled_magazine(struct zone *zone)
> +static inline struct free_magazine *find_lock_magazine(struct zone *zone)
>  {
> -	struct free_area_magazine *area = &zone->_noirq_magazine;
> -	if (!area->nr_free)
> +	int i = (raw_smp_processor_id() >> 1) & (NR_MAGAZINES-1);
> +	int start = i;
> +
> +	do {
> +		if (spin_trylock(&zone->noirq_magazine[i].lock))
> +			goto out;

I'm not sure doing it this way is great. It optimizes for lock
contention vs the initial cost of just fetching the cache line.
Doing the try lock already has to fetch the cache line, even
if the lock is contended.

Page allocation should be limited more by the cache line bouncing
than long contention

So you may be paying the fetch cost multiple times without actually
amortizing it.

If you want to do it this way I would read the lock only. That can
be much cheaper because it doesn't have to take the cache line 
exclusive. It may still need to transfer it though (because another
CPU just took it exclusive), which may be already somewhat expensive.

So overall I'm not sure it's a good idea.

-Andi

-- 
ak@...ux.intel.com -- Speaking for myself only
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ