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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0DD1AC19F2A for ; Fri, 29 Jul 2022 01:42:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 94EDC8E0001; Thu, 28 Jul 2022 21:42:01 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8FDD46B0072; Thu, 28 Jul 2022 21:42:01 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 79FD18E0001; Thu, 28 Jul 2022 21:42:01 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 6AD946B0071 for ; Thu, 28 Jul 2022 21:42:01 -0400 (EDT) Received: from smtpin31.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 411BD121087 for ; Fri, 29 Jul 2022 01:42:01 +0000 (UTC) X-FDA: 79738436442.31.07F02C6 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf13.hostedemail.com (Postfix) with ESMTP id 2ABDF200B5 for ; Fri, 29 Jul 2022 01:42:00 +0000 (UTC) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.56]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4Lv9Bc1zbXzWfhk; Fri, 29 Jul 2022 09:38:00 +0800 (CST) Received: from [10.174.177.76] (10.174.177.76) by canpemm500002.china.huawei.com (7.192.104.244) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Fri, 29 Jul 2022 09:41:54 +0800 Subject: Re: [RFC PATCH v4 8/8] hugetlb: use new vma_lock for pmd sharing synchronization To: Mike Kravetz CC: , , Muchun Song , Michal Hocko , Peter Xu , Naoya Horiguchi , David Hildenbrand , "Aneesh Kumar K . V" , Andrea Arcangeli , "Kirill A . Shutemov" , Davidlohr Bueso , Prakash Sangappa , James Houghton , Mina Almasry , Pasha Tatashin , Axel Rasmussen , Ray Fucillo , Andrew Morton References: <20220706202347.95150-1-mike.kravetz@oracle.com> <20220706202347.95150-9-mike.kravetz@oracle.com> From: Miaohe Lin Message-ID: <2adbbbd2-51d2-744d-77b4-374fe651873b@huawei.com> Date: Fri, 29 Jul 2022 09:41:54 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.177.76] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1659058921; a=rsa-sha256; cv=none; b=Ynl6FeZAK2EiYmBmaZOYwQA/9fJstKlTY0HVFkgX3n/T6rZKLi4k821M7zP3PzKvYTfk3g ynfCqRikdThlMeUiEEBoPKxJOXCnnpUBBA8ILl41G+bN918xkoUXT9z3jLVZpIN9QgF/of NBNpjyFdA4xQnpp+QkvUhZ9o6PF9zlY= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=none; spf=pass (imf13.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1659058921; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=cE6bbf/taHRntqd7PAyfFGEg6jWtxza40rgSmtqUiU0=; b=GfMeP55OJYisNQNDaOi7KzvUW2Rr/iPCxciNISLRq8R2bWP9pFTaddKJ69XLCoN8V6EopL oY7YYYTZSxKKw994ovJyJpP7ESIIld6HH86dKhAGYKN1/Ps1raDg9njxfwDtaE81OAR3g0 CJDrqFTPpuuo+4B/u+m4YVTcM/XlE2Q= Authentication-Results: imf13.hostedemail.com; dkim=none; spf=pass (imf13.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com X-Rspam-User: X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 2ABDF200B5 X-Stat-Signature: o88jiaphkknzb68k7k6y7i76q67dyyu9 X-HE-Tag: 1659058920-475797 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 2022/7/29 1:47, Mike Kravetz wrote: > On 07/28/22 14:51, Miaohe Lin wrote: snip >> >> Do we need to check &mm->mm_users == 0 here in case the address_space of corresponding process >> has exited? In this case, mmdrop will drop the last reference and free the skipped_mm. So we will >> use skipped_mm below after it's freed? >> > > Good point! > I think we need to wait to drop since we want to hold the read lock. > Will update. > >>> + vma = find_vma(skipped_mm, skipped_vm_start); >>> + if (!vma || vma->vm_file->f_mapping != mapping || >> >> If skipped_vm_start is unmapped and remapped as a anon vma before we taking the mmap_read_lock, >> vma->vm_file will be NULL? >> > > IIUC, vma->vm_file will always be set even for an anon vma. The fault > code depends on this. See beginning of hugetlb_fault() where we > unconditionally do: > > mapping = vma->vm_file->f_mapping; What if vma is non-hugetlb anon vma? Thanks.