From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754185AbcFHNFj (ORCPT ); Wed, 8 Jun 2016 09:05:39 -0400 Received: from mx2.suse.de ([195.135.220.15]:34658 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751610AbcFHNFh (ORCPT ); Wed, 8 Jun 2016 09:05:37 -0400 Date: Wed, 8 Jun 2016 06:05:24 -0700 From: Davidlohr Bueso To: Mel Gorman Cc: Thomas Gleixner , Sebastian Andrzej Siewior , Mike Galbraith , Davidlohr Bueso , Peter Zijlstra , lkml Subject: Re: [PATCH] futex: Calculate the futex key based on a tail page for file-based futexes Message-ID: <20160608130524.apzl5hogcpv5wxw2@linux-uzut.site> References: <20160607123017.GJ2469@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <20160607123017.GJ2469@suse.de> User-Agent: Mutt/1.6.1-neo () Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 07 Jun 2016, Mel Gorman wrote: >Mike Galbraith reported that the LTP test case futex_wake04 was broken >by commit 65d8fc777f6d ("futex: Remove requirement for lock_page() >in get_futex_key()"). > >This test case uses futexes backed by hugetlbfs pages and so there is an >associated inode with a futex stored on such pages. The problem is that >the key is being calculated based on the head page index of the hugetlbfs >page and not the tail page. > >Prior to the optimisation, the page lock was used to stabilise mappings and >pin the inode is file-backed which is overkill. If the page was a compound >page, the head page was automatically looked up as part of the page lock >operation but the tail page index was used to calculate the futex key. > >After the optimisation, the compound head is looked up early and the page >lock is only relied upon to identify truncated pages, special pages or a >shmem page moving to swapcache. The head page is looked up because without >the page lock, special care has to be taken to pin the inode correctly. >However, the tail page is still required to calculate the futex key so this >patch records the tail page. > >On vanilla 4.6, the output of the test case is; > >futex_wake04 0 TINFO : Hugepagesize 2097152 >futex_wake04 1 TFAIL : futex_wake04.c:126: Bug: wait_thread2 did not wake after 30 secs. > >With the patch applied > >futex_wake04 0 TINFO : Hugepagesize 2097152 >futex_wake04 1 TPASS : Hi hydra, thread2 awake! > >Reported-by: Mike Galbraith >Signed-off-by: Mel Gorman Reviewed-by: Davidlohr Bueso (and yay for maintaining performance)