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=-0.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS 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 5F879C4CEC4 for ; Mon, 23 Sep 2019 18:04:12 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 27BBE2089F for ; Mon, 23 Sep 2019 18:04:12 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="EDc55+Us" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 27BBE2089F Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id B064F6B000D; Mon, 23 Sep 2019 14:04:11 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A65AF6B000E; Mon, 23 Sep 2019 14:04:11 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9545D6B0010; Mon, 23 Sep 2019 14:04:11 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0156.hostedemail.com [216.40.44.156]) by kanga.kvack.org (Postfix) with ESMTP id 731176B000D for ; Mon, 23 Sep 2019 14:04:11 -0400 (EDT) Received: from smtpin04.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with SMTP id 0B16D180AD806 for ; Mon, 23 Sep 2019 18:04:11 +0000 (UTC) X-FDA: 75966959502.04.ear77_7bc312c64b409 X-HE-Tag: ear77_7bc312c64b409 X-Filterd-Recvd-Size: 5344 Received: from mail-lj1-f193.google.com (mail-lj1-f193.google.com [209.85.208.193]) by imf44.hostedemail.com (Postfix) with ESMTP for ; Mon, 23 Sep 2019 18:04:10 +0000 (UTC) Received: by mail-lj1-f193.google.com with SMTP id 7so14653561ljw.7 for ; Mon, 23 Sep 2019 11:04:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=1kR+G8ndtoJyKRtN7szpcKy6yBwnoxfBwdrDmTb45aE=; b=EDc55+UsUt1hlLqTRQpm9TOS1K4q0juc5fBusxwSGEQlx/lYD5sqi5FdaUC/djpdP9 fDW9guWgKyH5BjpKHGpvmcwvc2vRi5SCMb7hmXB4ugChfSwNDNWcht7pLo3VtEFR5Mug PetSOXu5wrIuFLoWC3lwUyfioMD/N0vuwvNWQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=1kR+G8ndtoJyKRtN7szpcKy6yBwnoxfBwdrDmTb45aE=; b=fPYnZYahblvUd0IgHG7KEZ137dKqjxouopZZ480GK8190ibeT/4EycuuN/8OtmwIAU MI+1inkZFV7x2k7QrvmLoOqehbU/NZ6Ikbr6KWhUS1GhRzc2iftMFM2kwl7K/tI7OIbE WVW26igNButnnewAPql/M4pLi549ZuVYsJJPTEUvX25AJFQVOIUqX6v0eavE8XLf0NUY iAWeFqWCEx5e2CDRK8hAS08LJIbeQrsI/nLM0DPlDnqfsCIKCjUi0nDniT2CRz/K8iW1 gEt2xdJ5F/bZK2XSQKhJXdw/+yEgU6Tuan2wXe3IT5J4twfss/hVUXMDPlzpDDGqkbst RJ/g== X-Gm-Message-State: APjAAAXuv4/N2V1Or+Ni4+jdH1XkSErILE7yC3AEYoMzfuFv0atY/xGX YmJgnPFr84+Bb9dSQ9iz9ftHLLjZDAg= X-Google-Smtp-Source: APXvYqzfooUYtxb6EqomDBFsplgp+UfiizCq/RGTLqvjeFeyhKXzoGcko2TL0QdQfObAfOXMwzvptQ== X-Received: by 2002:a2e:b055:: with SMTP id d21mr394483ljl.236.1569261848442; Mon, 23 Sep 2019 11:04:08 -0700 (PDT) Received: from mail-lf1-f50.google.com (mail-lf1-f50.google.com. [209.85.167.50]) by smtp.gmail.com with ESMTPSA id 134sm2359145lfk.70.2019.09.23.11.04.05 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 23 Sep 2019 11:04:05 -0700 (PDT) Received: by mail-lf1-f50.google.com with SMTP id u28so10844161lfc.5 for ; Mon, 23 Sep 2019 11:04:05 -0700 (PDT) X-Received: by 2002:a19:2489:: with SMTP id k131mr508976lfk.52.1569261845024; Mon, 23 Sep 2019 11:04:05 -0700 (PDT) MIME-Version: 1.0 References: <20190923042523.10027-1-peterx@redhat.com> <20190923042523.10027-6-peterx@redhat.com> In-Reply-To: <20190923042523.10027-6-peterx@redhat.com> From: Linus Torvalds Date: Mon, 23 Sep 2019 11:03:49 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v4 05/10] mm: Return faster for non-fatal signals in user mode faults To: Peter Xu Cc: Linux-MM , Linux Kernel Mailing List , David Hildenbrand , Hugh Dickins , Maya Gokhale , Jerome Glisse , Pavel Emelyanov , Johannes Weiner , Martin Cracauer , Marty McFadden , Shaohua Li , Andrea Arcangeli , Mike Kravetz , Denis Plotnikov , Mike Rapoport , Mel Gorman , "Kirill A . Shutemov" , "Dr . David Alan Gilbert" Content-Type: text/plain; charset="UTF-8" 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: On Sun, Sep 22, 2019 at 9:26 PM Peter Xu wrote: > > This patch is a preparation of removing that special path by allowing > the page fault to return even faster if we were interrupted by a > non-fatal signal during a user-mode page fault handling routine. So I really wish saome other vm person would also review these things, but looking over this series once more, this is the patch I probably like the least. And the reason I like it the least is that I have a hard time explaining to myself what the code does and why, and why it's so full of this pattern: > - if ((fault & VM_FAULT_RETRY) && fatal_signal_pending(current)) > + if ((fault & VM_FAULT_RETRY) && > + fault_should_check_signal(user_mode(regs))) > return; which isn't all that pretty. Why isn't this just static bool fault_signal_pending(unsigned int fault_flags, struct pt_regs *regs) { return (fault_flags & VM_FAULT_RETRY) && (fatal_signal_pending(current) || (user_mode(regs) && signal_pending(current))); } and then most of the users would be something like if (fault_signal_pending(fault, regs)) return; and the exceptions could do their own thing. Now the code is prettier and more understandable, I feel. And if something doesn't follow this pattern, maybe it either _should_ follow that pattern or it should just not use the helper but explain why it has an unusual pattern. Linus