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.9 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 54627C47404 for ; Wed, 9 Oct 2019 16:07:23 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 16DE8218DE for ; Wed, 9 Oct 2019 16:07:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="TPnX+oMw" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 16DE8218DE 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 9EFB38E0005; Wed, 9 Oct 2019 12:07:22 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 99EE78E0003; Wed, 9 Oct 2019 12:07:22 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 88ED38E0005; Wed, 9 Oct 2019 12:07:22 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0061.hostedemail.com [216.40.44.61]) by kanga.kvack.org (Postfix) with ESMTP id 68A618E0003 for ; Wed, 9 Oct 2019 12:07:22 -0400 (EDT) Received: from smtpin15.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with SMTP id 09CDF612F for ; Wed, 9 Oct 2019 16:07:22 +0000 (UTC) X-FDA: 76024725924.15.pipe98_231ac159e1631 X-HE-Tag: pipe98_231ac159e1631 X-Filterd-Recvd-Size: 4241 Received: from mail-lj1-f195.google.com (mail-lj1-f195.google.com [209.85.208.195]) by imf24.hostedemail.com (Postfix) with ESMTP for ; Wed, 9 Oct 2019 16:07:21 +0000 (UTC) Received: by mail-lj1-f195.google.com with SMTP id j19so3114641lja.1 for ; Wed, 09 Oct 2019 09:07:20 -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=rELG+/plJf3q+d36O9HDInY1Dcun/TTnnrXLzjvo97I=; b=TPnX+oMwcZyLImXtu7vSmBJQjvRZnSeQpjwCcSjIw1iXfTFPyHdDvmfv+2sxkpfUyj JFzZ1ddVjpVh5f2wFQpWMAb1+pTNRk6pnMCBs485QzCeAoFiVhQRRIOvJXJq1c8093k8 4e41ajmn2pB8buojmlyKC7PzJa0CJ57eJp4cM= 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=rELG+/plJf3q+d36O9HDInY1Dcun/TTnnrXLzjvo97I=; b=k3i2QGu6Ef62mAHAf/pDG6EbCsO9jhg7/ysUvPFFiVC4lJLdCwms1SRc6LlVNAC6q+ wtig1+YWYeEXiIiLcP56Mm+RWMT4/6bIgJRyuErV1b+oCyBgPj0PI5K6vakx0AYjzoi+ eHyi+Bqz6krMOESy/YhPGe3dBghoiPc63vJ1ZSakHSPNbLzsuYmeMzw0LZCaTZEKNL0a S+doz3DWXt7/P0/ok4kLxJx47DjY65Q6Qm2NcILaRtWUc33eLDNgEfotVfkJ5P862iey 5DeDfWs4YHGxBVWPWqns/Yg45L+DQKYqbA8Z251BO4aDaQYIG5U+rJAvm+xRQxyq+QaK BH1Q== X-Gm-Message-State: APjAAAU/Zd+i44zCii4rlqKyHKCRJ8dQV9Q9azTTPT7M0SQTeY8NhPii LIy7doUC8j/nW1oVZPgD9JEg/USS9SU= X-Google-Smtp-Source: APXvYqyBKnuQVVb6G8F601EKWRr1wA3yJsfduvyAyoDygHn/VdNQtDEAsJ1lRoGOvf13Pm/kPwXeSQ== X-Received: by 2002:a05:651c:8b:: with SMTP id 11mr2865804ljq.98.1570637238832; Wed, 09 Oct 2019 09:07:18 -0700 (PDT) Received: from mail-lj1-f169.google.com (mail-lj1-f169.google.com. [209.85.208.169]) by smtp.gmail.com with ESMTPSA id o13sm541046lji.31.2019.10.09.09.07.17 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 09 Oct 2019 09:07:17 -0700 (PDT) Received: by mail-lj1-f169.google.com with SMTP id f5so3058540ljg.8 for ; Wed, 09 Oct 2019 09:07:17 -0700 (PDT) X-Received: by 2002:a2e:9117:: with SMTP id m23mr2902767ljg.82.1570637236839; Wed, 09 Oct 2019 09:07:16 -0700 (PDT) MIME-Version: 1.0 References: <20191008091508.2682-1-thomas_os@shipmail.org> <20191008091508.2682-3-thomas_os@shipmail.org> <20191009151400.bserdtpoczmawqn5@box> In-Reply-To: <20191009151400.bserdtpoczmawqn5@box> From: Linus Torvalds Date: Wed, 9 Oct 2019 09:07:00 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v4 2/9] mm: pagewalk: Take the pagetable lock in walk_pte_range() To: "Kirill A. Shutemov" Cc: =?UTF-8?Q?Thomas_Hellstr=C3=B6m_=28VMware=29?= , Linux Kernel Mailing List , Linux-MM , Thomas Hellstrom , Matthew Wilcox , Will Deacon , Peter Zijlstra , Rik van Riel , Minchan Kim , Michal Hocko , Huang Ying , =?UTF-8?B?SsOpcsO0bWUgR2xpc3Nl?= 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 Wed, Oct 9, 2019 at 8:14 AM Kirill A. Shutemov wrote: > > If ->pte_entry() fails on the first entry of the page table, pte - 1 will > point out side the page table. > > And the '- 1' is totally unnecessary as we break the loop before pte++ on > the last iteration. Good catch. Too much copying the wrong pattern from other sources. I do wish we didn't have this pattern of "update pte, then do pte_unmap as long as it's in the same page". Yeah, it avoids a variable, but still... But it is what it is, and we just need to be careful. Linus