Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752844AbdCBPNE (ORCPT ); Thu, 2 Mar 2017 10:13:04 -0500 Received: from mga05.intel.com ([192.55.52.43]:45300 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751985AbdCBPMy (ORCPT ); Thu, 2 Mar 2017 10:12:54 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.35,231,1484035200"; d="scan'208";a="55021590" From: "Kirill A. Shutemov" To: Andrea Arcangeli , Andrew Morton Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, "Kirill A. Shutemov" Subject: [PATCH 0/4] thp: fix few MADV_DONTNEED races Date: Thu, 2 Mar 2017 18:10:30 +0300 Message-Id: <20170302151034.27829-1-kirill.shutemov@linux.intel.com> X-Mailer: git-send-email 2.11.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 801 Lines: 21 For MADV_DONTNEED to work properly with huge pages, it's critical to not clear pmd intermittently unless you hold down_write(mmap_sem). Otherwise MADV_DONTNEED can miss the THP which can lead to userspace breakage. See example of such race in commit message of patch 2/4. All these races are found by code inspection. I haven't seen them triggered. I don't think it's worth to apply them to stable@. Kirill A. Shutemov (4): thp: reduce indentation level in change_huge_pmd() thp: fix MADV_DONTNEED vs. numa balancing race thp: fix MADV_DONTNEED vs. MADV_FREE race thp: fix MADV_DONTNEED vs clear soft dirty race fs/proc/task_mmu.c | 9 +++++- mm/huge_memory.c | 86 ++++++++++++++++++++++++++++++++++++------------------ 2 files changed, 66 insertions(+), 29 deletions(-) -- 2.11.0