From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1761342AbcIXDWB (ORCPT ); Fri, 23 Sep 2016 23:22:01 -0400 Received: from mail-pf0-f181.google.com ([209.85.192.181]:33965 "EHLO mail-pf0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759169AbcIXDV7 (ORCPT ); Fri, 23 Sep 2016 23:21:59 -0400 Date: Fri, 23 Sep 2016 20:21:56 -0700 (PDT) From: Hugh Dickins X-X-Sender: hugh@eggly.anvils To: Linus Torvalds cc: Andrew Morton , Toshi Kani , Hillf Danton , "Kirill A. Shutemov" , "Aneesh Kumar K.V" , linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 1/3] shmem: fix tmpfs to handle the huge= option properly In-Reply-To: Message-ID: References: User-Agent: Alpine 2.11 (LSU 23 2013-08-11) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Toshi Kani shmem_get_unmapped_area() checks SHMEM_SB(sb)->huge incorrectly, which leads to a reversed effect of "huge=" mount option. Fix the check in shmem_get_unmapped_area(). Note, the default value of SHMEM_SB(sb)->huge remains as SHMEM_HUGE_NEVER. User will need to specify "huge=" option to enable huge page mappings. Reported-by: Hillf Danton Signed-off-by: Toshi Kani Acked-by: Kirill A. Shutemov Reviewed-by: Aneesh Kumar K.V Signed-off-by: Hugh Dickins --- mm/shmem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- 4.8-rc7/mm/shmem.c 2016-08-14 20:17:02.388843463 -0700 +++ linux/mm/shmem.c 2016-09-22 19:41:29.057848626 -0700 @@ -1980,7 +1980,7 @@ unsigned long shmem_get_unmapped_area(st return addr; sb = shm_mnt->mnt_sb; } - if (SHMEM_SB(sb)->huge != SHMEM_HUGE_NEVER) + if (SHMEM_SB(sb)->huge == SHMEM_HUGE_NEVER) return addr; }