From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.9 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 155B2C11D05 for ; Thu, 20 Feb 2020 14:54:47 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id B56BC208C4 for ; Thu, 20 Feb 2020 14:54:46 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="T6g3FSwv" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B56BC208C4 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id DD87A6B0007; Thu, 20 Feb 2020 09:54:44 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D5FBC6B0008; Thu, 20 Feb 2020 09:54:44 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B3B616B000A; Thu, 20 Feb 2020 09:54:44 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0055.hostedemail.com [216.40.44.55]) by kanga.kvack.org (Postfix) with ESMTP id 954156B0007 for ; Thu, 20 Feb 2020 09:54:44 -0500 (EST) Received: from smtpin02.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 2D0158248D52 for ; Thu, 20 Feb 2020 14:54:44 +0000 (UTC) X-FDA: 76510802088.02.boot03_466135b364a3c X-HE-Tag: boot03_466135b364a3c X-Filterd-Recvd-Size: 10347 Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) by imf45.hostedemail.com (Postfix) with ESMTP for ; Thu, 20 Feb 2020 14:54:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582210483; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=v2PMeN7qybuSQEDXKYxWNkEqNn7jREXm7U0q50qBB7U=; b=T6g3FSwv2QFYfo4vdxjTUBkHgJ9v1jkiK7MdOTScGv2jfWd1Q4c2gFfPpUs1E8qLEzV/3x XDzyVqEDjLcLxqXUcmupkQNVSMYRSPcfG91bRqSjr0TatLdkGNtW/WNMhRbGi30YGSW/rV LAuSV0xStv7mBaCjMvGgFbtEkDotGa0= Received: from mail-qv1-f72.google.com (mail-qv1-f72.google.com [209.85.219.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-176-GJ6g5mrPPS2_pAPRtfOu4g-1; Thu, 20 Feb 2020 09:54:36 -0500 Received: by mail-qv1-f72.google.com with SMTP id dc2so2701068qvb.7 for ; Thu, 20 Feb 2020 06:54:36 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=qAEo6uU0h6TrnB+AzJl8drGs8IaXdhtJTL4N71C1gc8=; b=QGgUETfe3mAPCT9t+wNFj8gditXvmeaL+Ea/lCNcr4OCZuTI+U8GvINl/HsjiVFRg0 aWi/Fgahvji2PXTlkeUihfLQAe4X9R1ZipRtn8Pycdt6HcchFFxlZm+8+x6JpjuXjaer OhuTcWDc3id1SO66reJ+lEX2bBEy2p0Hqli+8W/7Q4JQUznb5LdZSAhiwXvvSJ8XAj1C W3uY6FxQ+f+cUU5Rce2WY2fK51EqdeF6WtlggHaSI4IfQ4zD1wPrErjjyZG3HV9j7q+h rORwJzY5vR0uTcP15n/Brw7YJPwzU7Y6lAHEr+LBm2Scq3CzH0oBBk02EeyXIRVv8w9h 39xg== X-Gm-Message-State: APjAAAUdvJgorz3oQ/YQTvPQ/IRe5CbUymJOk+vWeh1D2NMVot0caD2i Y97bk2cZcJsrSCXNJGOzWavQ4CXbmiczkm2SE4X2q/RlChMT+hpOr4+g1xXH0NRDVAnZKJO5KPq 28NrFWXjNF/o= X-Received: by 2002:ac8:7352:: with SMTP id q18mr26316200qtp.125.1582210475702; Thu, 20 Feb 2020 06:54:35 -0800 (PST) X-Google-Smtp-Source: APXvYqzWsFS82ySidjbVlfdT63ypLLaoFMuctN0YET94MVG1TOfbG3OuA7PvkPxiht5byTbrB0g3mg== X-Received: by 2002:ac8:7352:: with SMTP id q18mr26316150qtp.125.1582210475282; Thu, 20 Feb 2020 06:54:35 -0800 (PST) Received: from xz-x1.redhat.com ([104.156.64.75]) by smtp.gmail.com with ESMTPSA id v82sm1725109qka.51.2020.02.20.06.54.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Feb 2020 06:54:34 -0800 (PST) From: Peter Xu To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Martin Cracauer , Mike Rapoport , Hugh Dickins , Jerome Glisse , peterx@redhat.com, "Kirill A . Shutemov" , Matthew Wilcox , Pavel Emelyanov , Brian Geffon , Maya Gokhale , Denis Plotnikov , Andrea Arcangeli , Johannes Weiner , "Dr . David Alan Gilbert" , Linus Torvalds , Mike Kravetz , Marty McFadden , David Hildenbrand , Bobby Powers , Mel Gorman Subject: [PATCH v6 00/16] mm: Page fault enhancements Date: Thu, 20 Feb 2020 09:54:16 -0500 Message-Id: <20200220145432.4561-1-peterx@redhat.com> X-Mailer: git-send-email 2.24.1 MIME-Version: 1.0 X-MC-Unique: GJ6g5mrPPS2_pAPRtfOu4g-1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: This is v6 of the series. It is majorly a rebase to 5.6-rc2, nothing else to be expected (plus some tests after the rebase). Instead of rewrite the cover letter I decided to use what we have for v5. Adding extra CCs for both Bobby Powers and Brian Geffon . Any review comment is appreciated. Thanks, =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D v5 cover letter =3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D This is v5 of the series. As Matthew suggested, I split the previous patch "mm: Return faster for non-fatal signals in user mode faults" into a few smaller ones: 1. One patch to introduce fatal_signal_pending(), and use it in archs that can directly apply 2. A few more patches to let the rest archs to use the new helper. With that we can have an unified entry for signal detection 3. One last patch to change fatal_signal_pending() to detect userspace non-fatal signal Nothing should have changed in the rest patches. Because the fault retry patches will depend on the previous ones, I decided to simply repost all the patches. Here's the new patchset layout: Patch 1-2: cleanup, and potential bugfix of hugetlbfs on fault retry Patch 3-9: let page fault to respond to non-fatal signals faster Patch 10: remove the userfaultfd NOPAGE emulation Patch 11-14: allow page fault to retry more than once Patch 15-16: let gup code to use FAULT_FLAG_KILLABLE too I would really appreciate any review comments for the series, especially for the first two patches which IMHO are even not related to this patchset and they should either cleanup or fix things. Smoke tested on x86 only. Thanks, v5: - split "mm: Return faster for non-fatal signals in user mode faults" into a few more patches, let all archs to use an unified entry for fast signal handling (fatal_signal_pending) v4: - use lore.kernel.org for all the links in commit messages [Kirill] - one more patch ("mm/gup: Fix __get_user_pages() on fault retry of hugetlb") to fix hugetlb path on fault retry - one more patch ("mm/gup: Allow to react to fatal signals") to: - use down_read_killable() properly [Linus] - pass in FAULT_FLAG_KILLABLE for all GUP [Linus] - one more patch ("mm/userfaultfd: Honor FAULT_FLAG_KILLABLE in fault path") to let handle_userfaultfd() respect FAULT_FLAG_KILLABLE. Should have no functional change after previous two new patches. v3: - check fatal signals in __get_user_page_locked() [Linus] - add r-bs v2: - resent previous version, rebase only =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D v1 cover letter =3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D This series is split out of userfaultfd-wp series to only cover the general page fault changes, since it seems to make sense itself. Basically it does two things: (a) Allows the page fault handlers to be more interactive on not only SIGKILL, but also the rest of userspace signals (especially for user-mode faults), and, (b) Allows the page fault retry (VM_FAULT_RETRY) to happen for more than once. I'm keeping the CC list as in uffd-wp v5, hopefully I'm not sending too much spams... And, instead of writting again the cover letter, I'm just copy-pasting my previous link here which has more details on why we do this: https://patchwork.kernel.org/cover/10691991/ The major change from that latest version should be that we introduced a new page fault flag FAULT_FLAG_INTERRUPTIBLE as suggested by Linus [1] to represents that we would like the fault handler to respond to non-fatal signals. Also, we're more careful now on when to do the immediate return of the page fault for such signals. For example, now we'll only check against signal_pending() for user-mode page faults and we keep the kernel-mode page fault patch untouched for it. More information can be found in separate patches. The patchset is only lightly tested on x86. All comments are greatly welcomed. Thanks, [1] https://lkml.org/lkml/2019/6/25/1382 Peter Xu (16): mm/gup: Rename "nonblocking" to "locked" where proper mm/gup: Fix __get_user_pages() on fault retry of hugetlb mm: Introduce fault_signal_pending() x86/mm: Use helper fault_signal_pending() arc/mm: Use helper fault_signal_pending() arm64/mm: Use helper fault_signal_pending() powerpc/mm: Use helper fault_signal_pending() sh/mm: Use helper fault_signal_pending() mm: Return faster for non-fatal signals in user mode faults userfaultfd: Don't retake mmap_sem to emulate NOPAGE mm: Introduce FAULT_FLAG_DEFAULT mm: Introduce FAULT_FLAG_INTERRUPTIBLE mm: Allow VM_FAULT_RETRY for multiple times mm/gup: Allow VM_FAULT_RETRY for multiple times mm/gup: Allow to react to fatal signals mm/userfaultfd: Honor FAULT_FLAG_KILLABLE in fault path arch/alpha/mm/fault.c | 6 +-- arch/arc/mm/fault.c | 35 +++++-------- arch/arm/mm/fault.c | 7 +-- arch/arm64/mm/fault.c | 26 +++------ arch/hexagon/mm/vm_fault.c | 5 +- arch/ia64/mm/fault.c | 5 +- arch/m68k/mm/fault.c | 7 +-- arch/microblaze/mm/fault.c | 5 +- arch/mips/mm/fault.c | 5 +- arch/nds32/mm/fault.c | 5 +- arch/nios2/mm/fault.c | 7 +-- arch/openrisc/mm/fault.c | 5 +- arch/parisc/mm/fault.c | 8 ++- arch/powerpc/mm/fault.c | 20 ++----- arch/riscv/mm/fault.c | 9 +--- arch/s390/mm/fault.c | 10 ++-- arch/sh/mm/fault.c | 13 +++-- arch/sparc/mm/fault_32.c | 5 +- arch/sparc/mm/fault_64.c | 5 +- arch/um/kernel/trap.c | 3 +- arch/unicore32/mm/fault.c | 8 ++- arch/x86/mm/fault.c | 30 +++++------ arch/xtensa/mm/fault.c | 5 +- drivers/gpu/drm/ttm/ttm_bo_vm.c | 12 +++-- fs/userfaultfd.c | 62 ++++++++++------------ include/linux/mm.h | 81 ++++++++++++++++++++++++---- include/linux/sched/signal.h | 14 +++++ mm/filemap.c | 2 +- mm/gup.c | 93 +++++++++++++++++++++------------ mm/hugetlb.c | 17 +++--- mm/internal.h | 6 +-- 31 files changed, 281 insertions(+), 240 deletions(-) --=20 2.24.1