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.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, 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 12969C43331 for ; Mon, 30 Mar 2020 18:50:56 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id CD31320771 for ; Mon, 30 Mar 2020 18:50:55 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="MZ2sqeTo" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CD31320771 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 74C0E6B000C; Mon, 30 Mar 2020 14:50:55 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6D4486B000E; Mon, 30 Mar 2020 14:50:55 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 59BC26B0032; Mon, 30 Mar 2020 14:50:55 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0048.hostedemail.com [216.40.44.48]) by kanga.kvack.org (Postfix) with ESMTP id 3E7FD6B000C for ; Mon, 30 Mar 2020 14:50:55 -0400 (EDT) Received: from smtpin22.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id E625F180AD811 for ; Mon, 30 Mar 2020 18:50:54 +0000 (UTC) X-FDA: 76652920428.22.boot83_250ca36aa1c1c X-HE-Tag: boot83_250ca36aa1c1c X-Filterd-Recvd-Size: 4815 Received: from mail-ed1-f68.google.com (mail-ed1-f68.google.com [209.85.208.68]) by imf04.hostedemail.com (Postfix) with ESMTP for ; Mon, 30 Mar 2020 18:50:54 +0000 (UTC) Received: by mail-ed1-f68.google.com with SMTP id o1so3826474edv.1 for ; Mon, 30 Mar 2020 11:50:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=uq6i06ZRPQUaQNiRIjd3mMYsSETxbSCVlPPKZNi2Fmg=; b=MZ2sqeToqwXrscQMskj6uYIRmD406jk1egY6bWS2RndDTKDwoV3uYQhinlkJmG8z1v yYw7dzwM0VyXScUrjZavK8X5ZZelKwaleN74tPlxP6phHfBb/W6DlC4rLqrrDz42zaxn FJC3DNBU4E95w+aoOPVZZP+fZcwLdFa2mlb6V0/7i+fJOKJ3NSc7KXSunLtx4/HhMiic UI9z58gIXTc38SAPtiQX5joMBrtceuQZLhjkrn1tYVHZTLRuZzDpYuA9Zj5Ou6PpgFpr le8TqGIdC31vFF6X7zYuzTArvuxDtlve5pIlkW5eHANO1e3k4WAr3n8tzJF3UvLT99pF 8Rlw== 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=uq6i06ZRPQUaQNiRIjd3mMYsSETxbSCVlPPKZNi2Fmg=; b=hlpddu4aYrVfGdLN3MrJaG9ZPzw42Yj4OFMxZGcOMIhrREcIZWQGAq0sv7Mvc7mOH+ JfbqbmSzinkVhnaAmTfJGqhHCaXJBFduf7Lixs+W43kUnEuKg9GESU2HxIJ/V7zykVx8 ZzD6aPn9uvm70xR21Ls3ureharPudm+1LkUW2tubVRho1bCmgKdPZbE5gzJj8wcaUtty K9ro30G5IK4r79dqGew8Wn47XyZeJFXBMqdrJWmktI3f14hqz8YNBsSIc2Q08NqE9eNk AEDJfc+fuS7dFJBeD0j30aqAgWZGnvxO/U6QxsQ/Cdjsd2YsQ/Xl8dqSAg1+JovbJQ90 nmKA== X-Gm-Message-State: ANhLgQ2mH02q5J93W94BsAyWN2MaTYKeTc9QVj4ZOw+OT2IwZ38qpnDM hYIS76NIB2UHx+IoY2DQoipVel2hCCGc3fgwY94= X-Google-Smtp-Source: ADFU+vuQT/sSZscTjeUisaiLMkmUZGobafKEtxOMGFoQBGQAKBG2rMTI0iCHnv2MLYY0Ke5eLuRBRpb0i2h5glzSD3k= X-Received: by 2002:a50:9f6e:: with SMTP id b101mr12539035edf.372.1585594253518; Mon, 30 Mar 2020 11:50:53 -0700 (PDT) MIME-Version: 1.0 References: <20200327170601.18563-1-kirill.shutemov@linux.intel.com> <20200327170601.18563-6-kirill.shutemov@linux.intel.com> <20200328003920.xvkt3hp65uccsq7b@box> <20200328123336.givyrh5hsscg5cpx@box> In-Reply-To: <20200328123336.givyrh5hsscg5cpx@box> From: Yang Shi Date: Mon, 30 Mar 2020 11:50:41 -0700 Message-ID: Subject: Re: [PATCH 5/7] khugepaged: Allow to collapse PTE-mapped compound pages To: "Kirill A. Shutemov" Cc: Zi Yan , Andrew Morton , Andrea Arcangeli , Linux MM , Linux Kernel Mailing List , "Kirill A. Shutemov" 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 Sat, Mar 28, 2020 at 5:33 AM Kirill A. Shutemov wrote: > > On Fri, Mar 27, 2020 at 09:17:00PM -0400, Zi Yan wrote: > > > The compound page may be locked here if the function called for the first > > > time for the page and not locked after that (becouse we've unlocked it we > > > saw it the first time). The same with LRU. > > > > > > > For the first time, the compound page is locked and not on LRU, so this VM_BUG_ON passes. > > For the second time and so on, the compound page is unlocked and on the LRU, > > so this VM_BUG_ON still passes. > > > > For base page, VM_BUG_ON passes. > > > > Other unexpected situation (a compound page is locked and on LRU) triggers the VM_BU_ON, > > but your VM_BUG_ON will not detect this situation, right? > > Right. I will rework this code. I've just realized it is racy: after > unlock and putback on LRU the page can be locked by somebody else and this > code can unlock it which completely borken. > > I'll pass down compound_pagelist to release_pte_pages() and handle the > situation there. > > > >>> if (likely(writable)) { > > >>> if (likely(referenced)) { > > >> > > >> Do we need a list here? There should be at most one compound page we will see here, right? > > > > > > Um? It's outside the pte loop. We get here once per PMD range. > > > > > > 'page' argument to trace_mm_collapse_huge_page_isolate() is misleading: > > > it's just the last page handled in the loop. > > > > > > > Throughout the pte loop, we should only see at most one compound page, right? > > No. mremap(2) opens a possibility for HPAGE_PMD_NR compound pages for > single PMD range. Do you mean every PTE in the PMD is mapped by a sub page from different THPs? > > > -- > Kirill A. Shutemov >