From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752121AbbJPWJO (ORCPT ); Fri, 16 Oct 2015 18:09:14 -0400 Received: from aserp1040.oracle.com ([141.146.126.69]:37395 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751342AbbJPWJM (ORCPT ); Fri, 16 Oct 2015 18:09:12 -0400 From: Mike Kravetz To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Dave Hansen , Naoya Horiguchi , Hugh Dickins , Davidlohr Bueso , Andrew Morton , Mike Kravetz Subject: [PATCH 0/3] hugetlbfs fallocate hole punch race with page faults Date: Fri, 16 Oct 2015 15:08:27 -0700 Message-Id: <1445033310-13155-1-git-send-email-mike.kravetz@oracle.com> X-Mailer: git-send-email 2.4.3 X-Source-IP: userv0022.oracle.com [156.151.31.74] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The hugetlbfs fallocate hole punch code can race with page faults. The result is that after a hole punch operation, pages may remain within the hole. No other side effects of this race were observed. In preparation for adding userfaultfd support to hugetlbfs, it is desirable to plug or significantly shrink this hole. This patch set uses the same mechanism employed in shmem (see commit f00cdc6df7). hugetlb_fault_mutex_table is already used in hugetlbfs for fault synchronization, and there is no swap for hugetlbfs. So, this code is simpler than in shmem. In fact, the hugetlb_fault_mutex_table could be used for races with small hole punch operations. However, we need something that will work for large holes as well. Mike Kravetz (3): mm/hugetlb: Define hugetlb_falloc structure for hole punch race mm/hugetlb: Setup hugetlb_falloc during fallocate hole punch mm/hugetlb: page faults check for fallocate hole punch in progress and wait fs/hugetlbfs/inode.c | 26 +++++++++++++++++++++++--- include/linux/hugetlb.h | 10 ++++++++++ mm/hugetlb.c | 37 +++++++++++++++++++++++++++++++++++++ 3 files changed, 70 insertions(+), 3 deletions(-) -- 2.4.3