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=-12.9 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1, USER_IN_DEF_DKIM_WL 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 77393C433E7 for ; Fri, 9 Oct 2020 22:23:23 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id E55B22231B for ; Fri, 9 Oct 2020 22:23:22 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="lh/6y8Dn" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E55B22231B Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 1C27A940012; Fri, 9 Oct 2020 18:23:22 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 14D0194000C; Fri, 9 Oct 2020 18:23:22 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F06CD940012; Fri, 9 Oct 2020 18:23:21 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0201.hostedemail.com [216.40.44.201]) by kanga.kvack.org (Postfix) with ESMTP id BA5DC94000C for ; Fri, 9 Oct 2020 18:23:21 -0400 (EDT) Received: from smtpin05.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 4C1333629 for ; Fri, 9 Oct 2020 22:23:21 +0000 (UTC) X-FDA: 77353814202.05.girls01_4b15ef9271e4 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin05.hostedemail.com (Postfix) with ESMTP id 2F5DB18014C90 for ; Fri, 9 Oct 2020 22:23:21 +0000 (UTC) X-HE-Tag: girls01_4b15ef9271e4 X-Filterd-Recvd-Size: 6322 Received: from mail-oi1-f195.google.com (mail-oi1-f195.google.com [209.85.167.195]) by imf29.hostedemail.com (Postfix) with ESMTP for ; Fri, 9 Oct 2020 22:23:20 +0000 (UTC) Received: by mail-oi1-f195.google.com with SMTP id n2so11802279oij.1 for ; Fri, 09 Oct 2020 15:23:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=Xfvh23nsFhdOAwjXTF5OSDmVXedEc81TbeoYKAL0kNY=; b=lh/6y8Dnke8lKCfFOufel5NfiYvOpCawa8hm6OT672bczO/yUm+YypNSvyVrYbA3ki H5gjiBQsPRgrJwVCTDAOyTzcgEsaD8u6n7Ui7jTWydAG/lm81VeAK+rqEe/6z19P4ugL 7kbop8EJZokKXVTg7xpRC0kc7HyKb/O/kxb68gcq313TTkqOmEG10vBnNNVevJlhk0Gt 7ccCwjAdbJnktFvKxUF8a1aMwqghjVSH7BUt0A/tJvOgqnWI2wZXBi8qD9mJ/1O0UagA 65WvNujRnsrUdbi6FuVMV75zHz5/7XwWihwSTJb+dj4/RcZmRbI8rwgxdQwlCLGDu+3k 4RiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version; bh=Xfvh23nsFhdOAwjXTF5OSDmVXedEc81TbeoYKAL0kNY=; b=dkR2n+/Rt+zeDRNl8zrGlIqukXsHXA9jiF9E5IG5K6aOacD55o2BqJWQCOWYF4J+9b VjIUbbvWCOH5Pp+V4IQvi0gJK26z+V1MLvw1kRBDsrtHXnri6jAXjfpzAZrD/+0yXhpO QK9zluBw7HZSFaxQh4G9iZOhqzcRScyD6sZEWqELHoWbbqMftcSIEYPuhH0oVCFaQDJ+ Wb/1tKVRGms4Hy6F2Mezf56p7LEfPNRyJFdVdju0BCTKv1Z899q2ipoF2SegwXePZ0bC B6Z5pvnY8Vu0AVidxJAR3iq25P5+jSnFpoPQZlBQTgGd0FjASWpa18utH+JCeK5Pf84d 2QGw== X-Gm-Message-State: AOAM533KH7MC502CXmspcl3zQWrSMyYcm7dSmxFLBcsjWfRh3T0D+YyM L2ZxVr0u6AV0rpInKGy9WCO6Kw== X-Google-Smtp-Source: ABdhPJx+JyZPLP8+OUUbayFGe+b0GRvSN/9xjqV8gLRV6L9OkuaBMsrITRFCyjUrFp/lausQfDIufA== X-Received: by 2002:aca:1105:: with SMTP id 5mr4030194oir.46.1602282199834; Fri, 09 Oct 2020 15:23:19 -0700 (PDT) Received: from eggly.attlocal.net (172-10-233-147.lightspeed.sntcca.sbcglobal.net. [172.10.233.147]) by smtp.gmail.com with ESMTPSA id a16sm6705145otk.39.2020.10.09.15.23.17 (version=TLS1 cipher=ECDHE-ECDSA-AES128-SHA bits=128/128); Fri, 09 Oct 2020 15:23:18 -0700 (PDT) Date: Fri, 9 Oct 2020 15:23:03 -0700 (PDT) From: Hugh Dickins X-X-Sender: hugh@eggly.anvils To: Mike Kravetz cc: Hugh Dickins , Qian Cai , js1304@gmail.com, Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, kernel-team@lge.com, Vlastimil Babka , Christoph Hellwig , Roman Gushchin , Naoya Horiguchi , Michal Hocko , Joonsoo Kim Subject: Re: [PATCH v3 7/8] mm/mempolicy: use a standard migration target allocation callback In-Reply-To: <68e09cac-d2d9-9ddf-6e10-0b8cc0befe82@oracle.com> Message-ID: References: <1592892828-1934-1-git-send-email-iamjoonsoo.kim@lge.com> <1592892828-1934-8-git-send-email-iamjoonsoo.kim@lge.com> <20200708012044.GC992@lca.pw> <68e09cac-d2d9-9ddf-6e10-0b8cc0befe82@oracle.com> User-Agent: Alpine 2.11 (LSU 23 2013-08-11) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII 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 Fri, 9 Oct 2020, Mike Kravetz wrote: > On 10/8/20 10:50 PM, Hugh Dickins wrote: > > > > It's a problem I've faced before in tmpfs, keeping a hold on the > > mapping while page lock is dropped. Quite awkward: igrab() looks as > > if it's the right thing to use, but turns out to give no protection > > against umount. Last time around, I ended up with a stop_eviction > > count in the shmem inode, which shmem_evict_inode() waits on if > > necessary. Something like that could be done for hugetlbfs too, > > but I'd prefer to do it without adding extra, if there is a way. > > Thanks. I failed to come up with anything neater than a stop_eviction count in the hugetlbfs inode. But that's not unlike a very special purpose rwsem added into the hugetlbfs inode: and now that you're reconsidering how i_mmap_rwsem got repurposed, perhaps you will end up with an rwsem of your own in the hugetlbfs inode. So I won't distract you with a stop_eviction patch unless you ask: that's easy, what you're looking into is hard - good luck! Hugh > >> > >> As mentioned above, I hope all this can be removed. > > > > If you continue to nest page lock inside i_mmap_rwsem for hugetlbfs, > > then I think that part of hugetlb_page_mapping_lock_write() has to > > remain. I'd much prefer that hugetlbfs did not reverse the usual > > nesting, but accept that you had reasons for doing it that way. > > Yes, that is necessary with the change to lock order. > > Yesterday I found another issue/case to handle in the hugetlb COW code > caused by the difference in lock nesting. As a result, I am rethinking > the decision to change the locking order. > > The primary reason for changing the lock order was to make the hugetlb > page fault code not have to worry about pte pointers changing. The issue > is that the pte pointer you get (or create) while walking the table > without the page table lock could go away due to unsharing the PMD. We > can walk the table again after acquiring the lock and validate and possibly > retry. However, the backout code in this area which previously had to > deal with truncation as well, was quite fragile and did not work in all > corner cases. This was mostly due to lovely huge page reservations. > I thought that adding more complexity to the backout code was going to > cause more issues. Changing the locking order eliminated the pte pointer > race as well as truncation. However, it created new locking issues. :( > > In parallel to working the locking issue, I am also exploring enhanced > backout code to handle all the needed cases. > -- > Mike Kravetz