Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp3096398pxu; Sat, 10 Oct 2020 19:49:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwbbtxwbuBYXMCWfTjc14ZPSmf4MLHtajBTp6Futl759xdJjZZZpYgJfDMZDdh7eq5vnK7Y X-Received: by 2002:a05:6402:3c1:: with SMTP id t1mr6905092edw.231.1602384567441; Sat, 10 Oct 2020 19:49:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602384567; cv=none; d=google.com; s=arc-20160816; b=iU/H9Uo9XullgEAeeHD4tB3orf9r7pUYVHz6cdYixtByxSBOYslURYzgo4U2TKOQxu MrTpaKaiMYhFjXoYm3wqNQL1qOyId9Ee+jwbHrmWeLaTrJC5Za8ifTA9+7R/3YcSvQlr 3AI9RWDfyazcVbFQWbF4wM+8fl9qRosSbYC6YZsCGgWuWMIWJcxiYLJgdj26P+M8p8vR nK5HRdYz4fM2Z2ap49U+XsB4+WXUaTaeOZQtypCnKwcFKxkLOf9p0lGWw4Sz4kBVhES0 D7YzzrpX1bVk6IXRfvmrjn9WCeJoILhNsD52/DMJEX3WcgGkbyqmxFrVhstHpqJ9caBV jQMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:message-id :in-reply-to:subject:cc:to:from:date:dkim-signature; bh=Xfvh23nsFhdOAwjXTF5OSDmVXedEc81TbeoYKAL0kNY=; b=toL6Bu1A5c/t73XXrcwFPqIY84RYbi6UVAdSgiq6+9lpoKYQ7oL2uGMVAfjdu+XsAw Taomc88+ibcPwdXmr0QROEl8h9b547m/SUdodqvZtxmKVDR9ZIc+Xy+n/77I11/lLGB2 OoHmImuaFVcZrZD9DvI6VitbPUcQ6L5sYqqNDuHOJigWTnRZLgEHQMOepPuQfr7JzVov x1q+618gc+L5sTQR7nbf3bLIdBtKmCo0dhCqv7R8jCFOu+LAplmAANj4PxpcZAA4jaYr pBVXweMTplt6b+sR8+vuPRG64Oa3vRpMry0GW1O33QpRTeevHbvmzC9KUPWG7q6Swo+P n9Ng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="lh/6y8Dn"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y21si10187390edm.83.2020.10.10.19.49.04; Sat, 10 Oct 2020 19:49:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="lh/6y8Dn"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391093AbgJIWXW (ORCPT + 99 others); Fri, 9 Oct 2020 18:23:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42436 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387542AbgJIWXW (ORCPT ); Fri, 9 Oct 2020 18:23:22 -0400 Received: from mail-oi1-x243.google.com (mail-oi1-x243.google.com [IPv6:2607:f8b0:4864:20::243]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C69FFC0613D2 for ; Fri, 9 Oct 2020 15:23:20 -0700 (PDT) Received: by mail-oi1-x243.google.com with SMTP id c13so11767050oiy.6 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=gTUwcih2gmt/gaf8M00p6Ju/kA+0UQgohi8xa828645iOf0eLUaTp5mqEnjZwlWF0Z U1ML+lAUiKs1PzCsgPhftuXV+3JOdncDSFuVqHYuhZe8KLDwzsWgvgujaZgWax+KK53K dYzVnBcPwHrIpBLA+eB91//9BS8da+0yi6wO8lKOmMBEYY0qdjo4/piKVocv8LfQlAwF PbWC+I+vtRzqFh74TUIVcYCF5VxFZgq3dCmh0fe/rr1ZkM3fKdUFDRh5SPVupjX7ESad QasWqWNqUXpsnUO0y8+A88mQgFn9Rtc/afBQvllPKGcoLOTvsnr37oWTqYulPbaCD+Dq M0FA== X-Gm-Message-State: AOAM530Ob9FZ2YEONPkZxbey1tEvzN0ZA51o3euA3cKgYM3bTtOfKuDH n0QeAWpOJdnx0t7A3TwWEapaPw== 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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