Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp1674157pxb; Fri, 1 Apr 2022 22:29:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJws3oRMyVGT/BkTFJE+V2A6WomYDSW14VYLsIS50hckBpxleHE2GwY2C1iTqznq5L+q+urJ X-Received: by 2002:a65:674b:0:b0:381:6565:26fc with SMTP id c11-20020a65674b000000b00381656526fcmr17500208pgu.618.1648877343515; Fri, 01 Apr 2022 22:29:03 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1648877343; cv=pass; d=google.com; s=arc-20160816; b=hnCnpXu+ynWCfagwRSSuWAFkQIG63s8eM+PSF6mQC2LZT130z0B0Yw9+vkdVYxmnsf pEIwsGQ375bub+3cw72Hh2uD9TulXLXu71+rwQHSv25zcmGV2SY4VmQ8hoIlEK91dZY0 XaLbNGsKHBJ6KiodOGpOF0XwnPCJ/Z2wEl/QUI09FAvXW5OtxI3JAc6ysCo+glwgJuYH +vj0fdGZWikjVrtiwNwshQJfz38Fj2sk4P25V0lR7+eGNZIeWCMhmFvuTrU+UhC3LKs2 7w5v+6qYY1g/G+hLRUE3sM0pSgh6ddVFrsFpa/a6kWEg/VfnoKCSPpBCNQGYpfQp31GA Ddbg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :in-reply-to:organization:from:references:cc:to:content-language :subject:user-agent:date:message-id:dkim-signature; bh=3EF+Q2R2VRE6MXe5yV5yQEaHL1L1UKjIEwysxrHJ7hY=; b=C9xIfMSKmSygJbMMo4txNz+s+J8TdlBn1VGs+6Xvn0VgeH+xgH5wbFFo7aym2hD+H7 nYJs+cTkaTusRgV5SE8dGQXCSqF7nzjpb/L+uiMB9x/hNn9w+o1KFkWiJbPqL6tzeKbC JLa+SZ85XbIqhM3iL5lxeJt9dYG6lxtDvGRy84kbITWnHAwM7u42Cd0nL7Kn32v/lm78 kIaBLMuWjmMfC5hicaiFjdOMIDZ2/YZimxYdVhwZvN+WF0oT9j2kxXTD5rRt8FQxO5bV mjGt/H8j1JnA7XRHycQ1x2c0TkgmOw/kq2nIFq3Dko2LlRGZ49vEfc08rsfYG4I/WNUY v6Bg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b="dQ1t9/L8"; arc=pass (i=1 spf=pass spfdomain=amd.com dkim=pass dkdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j24-20020a17090a841800b001c70d2622bbsi3898983pjn.109.2022.04.01.22.28.42; Fri, 01 Apr 2022 22:29:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b="dQ1t9/L8"; arc=pass (i=1 spf=pass spfdomain=amd.com dkim=pass dkdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351654AbiDAUKh (ORCPT + 99 others); Fri, 1 Apr 2022 16:10:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40848 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351647AbiDAUKa (ORCPT ); Fri, 1 Apr 2022 16:10:30 -0400 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1anam02on2058.outbound.protection.outlook.com [40.107.96.58]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C073363F8; Fri, 1 Apr 2022 13:08:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=B7NuSIqWSDYaONOH63kOKjr/j0dYmWixNttt7ZszJ39r/2b+OksVmPFudnIZuOuPOB82r6WNdoMwqcjgOHeay/uqmZMNQHulVuBDLdo5y/ntiXKX05XCmlazYe7+AktDyNyECiRB4tgAozdl/KSxb8Dli2TLZedHJ9xdWD89QSIU2d7dM5AkqWcj75A/z8eS8xnEbDwPmKBBIZAf16Mou4ULhAbC8FMRMa620ZtaPK+KzPSaLOI1R4NMKE4oIZ8CjYi5uAHzKnOXVEogYZVFzVh8UmlynkiZ+hEsKMmSeCclZjsRV7SywC3AfcSc2EafkSkgsmMoHYrBZb6EjD++rg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=3EF+Q2R2VRE6MXe5yV5yQEaHL1L1UKjIEwysxrHJ7hY=; b=i5EiPvZ0nuconhGUYIZup4LuZ8rZ7z5HlWM20L2ljg/UbKB0lEVp9TwOiA4VXzoZUygGCQOmfM8hDU6zO77xZB0RoXxg0raAS6aulyn5CE1etQxNwX1fXYkICSzuIZVHfK8doqLd31+16YZSiTMwGex352ycMWn2p/JCysCvznzf9ViQlh0xZVuFTynqjXIhWRMgHYRgRQbt79Cc5IV/m1F5OR+f0t5U7Z7X80ZZCeMZmZvlgqDueSp+CFt1ui7pvY4Iqu2ytboj8n6N6usqs9wkUfcMESH4TvccdC/cHUut0g70n8Ik0NAODaJctpIeDst0y6hiBjvVmJjgLnyGkA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=3EF+Q2R2VRE6MXe5yV5yQEaHL1L1UKjIEwysxrHJ7hY=; b=dQ1t9/L8zY3Mbn/Gsl/fCezo3KM9Yn6AbPauh2eJlQ395hB5jr1U2N4LM58tRDmCEIyCdQe+acWw6KjODyg2Ng2Od3S5azM/ShPhSOiV1TL6YgEKuXyyPhTB4MpUhCdNpv22yrZJnykkPTvemINs0d6NVC43RiatQFF0CIPDIxE= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from BN9PR12MB5115.namprd12.prod.outlook.com (2603:10b6:408:118::14) by BN8PR12MB2929.namprd12.prod.outlook.com (2603:10b6:408:9c::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5123.26; Fri, 1 Apr 2022 20:08:37 +0000 Received: from BN9PR12MB5115.namprd12.prod.outlook.com ([fe80::4839:9431:1040:5cd5]) by BN9PR12MB5115.namprd12.prod.outlook.com ([fe80::4839:9431:1040:5cd5%3]) with mapi id 15.20.5123.026; Fri, 1 Apr 2022 20:08:36 +0000 Message-ID: <82ed845d-2534-490c-f9b9-a875e0283cc9@amd.com> Date: Fri, 1 Apr 2022 16:08:35 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Subject: Re: [PATCH v2 1/3] mm: add vm_normal_lru_pages for LRU handled pages only Content-Language: en-US To: Christoph Hellwig , Alex Sierra Cc: jgg@nvidia.com, david@redhat.com, linux-mm@kvack.org, rcampbell@nvidia.com, linux-ext4@vger.kernel.org, linux-xfs@vger.kernel.org, amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, jglisse@redhat.com, apopple@nvidia.com, willy@infradead.org, akpm@linux-foundation.org References: <20220330212537.12186-1-alex.sierra@amd.com> <20220330212537.12186-2-alex.sierra@amd.com> <20220331085341.GA22102@lst.de> From: Felix Kuehling Organization: AMD Inc. In-Reply-To: <20220331085341.GA22102@lst.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-ClientProxiedBy: MN2PR17CA0032.namprd17.prod.outlook.com (2603:10b6:208:15e::45) To BN9PR12MB5115.namprd12.prod.outlook.com (2603:10b6:408:118::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 102534fd-ee60-456f-de85-08da141b67f2 X-MS-TrafficTypeDiagnostic: BN8PR12MB2929:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: YwdsWEuOsKnrDC5kis7yJ76cuBN+ARXyx0DrmoC7YQpMIz0/cz8pUIej+VGux2ZnDdwmm+6bD2hnjBnBqpDMyyayTvSXCwv8dysXwfcAUNrDFs0rbUc8Irp+JOPZOSUODvjPsEXDAwxsUK2pT2UZYEVmI4rErFUElJ8EZutZdonxcWnf5ZGnirZpCB8sAFIIL3ZX+4++oZ9cKtAhndPbFz4H2FmGWGkjrja/egZaobyUZkaKIY5q4icQGZm++Ek+HkldRuojxmuVcbBZd65khajWkqr/Fs0B+DZl3JmmRaVymHaUhx3l8S2DuivuiM4r+EyvdYSgG/u3k1PxWQ++gAU+0kz0YFbQu5kzbbv0QZ7jf5spnnc2V6G7LUpr6OQ0Xxb+iFpgl0ftNJ5FV5HR52kRnDTu34CbSMVE9E559W1A9w+nm7EgN8hVptL5p42s18XJPcZ9vBNm310ctvlDuTTSh6LHBgIyfC7zLYfisREGjZySCJKBX+OmRyEPAM4wtRbr2Cvm6pZQj7F7keklT0lGbGKJ1BEYHtHlwvaaL8cXNAhLvD3cGnQwA2pPDA9GPFIaZADZvu9YIoe+17oS1qNcR7r1naX+Tz6XTmYFXN9GOTbUlONKhDpP/I0J32wiHaCUHjufIEKtOKOYYuH29/WwKVUH+9yQfAq41GoXR4sBaV0LGoK6H+9IdRjz1OfVIDSdvN6d33RyIM8qp86maTvucYD51KG0f0IIhagI8ztW4MLwMWvpoQ9vjHVBd+Fy X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BN9PR12MB5115.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(4636009)(366004)(53546011)(8936002)(36756003)(2906002)(7416002)(26005)(36916002)(186003)(31686004)(2616005)(6512007)(6506007)(508600001)(38100700002)(110136005)(316002)(6636002)(31696002)(86362001)(66946007)(4326008)(66476007)(5660300002)(44832011)(8676002)(66556008)(6486002)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?NTJ0MkYweHNDV3F5L1JjZkh4QmR3c3ZrbDlhbUtJbGI5RlR0K3c4RU1jV2ls?= =?utf-8?B?UDFzM0ZCNFM1UlpPNk9yRkg3VWQ5NTNNK0RydEYzWFpqZmxINWs5dEFKMDlS?= =?utf-8?B?S1NPdjk1cCs5Snk4dDRNZk1JamltMVNHeTN3WmE5dmorUkNFR2drVHpyOVVt?= =?utf-8?B?Qmlka0RyU29YRlFkTE1yandRS0xEb3RxTFJnWmFpSDhqUmN3VHlXbG9Sb1kr?= =?utf-8?B?ZzhEWlEyemlpeTdYMjVtd2xhS0NpZGZNTkZPNDZBQlFKT0liQnp6aGRyVWdZ?= =?utf-8?B?bDQ4OEVjSGxUN0NiOGhGeVdFYk05QzNjOW9LRTNOcXVzQUVSNlV4NjFyYkVr?= =?utf-8?B?K3JzeExqZVllN0J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V0QkpDVjFmVmxj?= =?utf-8?B?T3JGeU5rcVlmVFlkUlpQUlZUMXBtbWRtR0pnYnZ3K0lTZ3Fpdk1kWDNVdDBJ?= =?utf-8?B?UTJnRkR6LzVXcHBGWnZsMVQwWnNJNHB2RTNJd0J3RVc5ckhKT1k2SmYwLzBj?= =?utf-8?B?M0FFMXFQejJMcDNxT1o1bmFaY21Pck1HMEZISzhIUzFsUGJLZUtKZz09?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 102534fd-ee60-456f-de85-08da141b67f2 X-MS-Exchange-CrossTenant-AuthSource: BN9PR12MB5115.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Apr 2022 20:08:36.9019 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: tgg9i3FXs7OVQZRpagmfav/jVdJhxfdMXZ0Lzw1pzFR9DGk1PlIApNS5TuwI71ExHTpRNg3Uo8WUqDr97Z4w3Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN8PR12MB2929 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_MSPIKE_H2, SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On 2022-03-31 04:53, Christoph Hellwig wrote: >> - page = vm_normal_page(vma, addr, pte); >> + page = vm_normal_lru_page(vma, addr, pte); > Why can't this deal with ZONE_DEVICE pages? It certainly has > nothing do with a LRU I think. In fact being able to have > stats that count say the number of device pages here would > probably be useful at some point. Maybe at some point. However, this is in a function called "can_gather_numa_stats". There are no meaningful NUMA stats for device pages. I agree that the name "vm_normal_lru_page" is not optimal in this case. > > In general I find the vm_normal_lru_page vs vm_normal_page > API highly confusing. An explicit check for zone device pages > in the dozen or so spots that care has a much better documentation > value, especially if accompanied by comments where it isn't entirely > obvious. OK. We can do that. It would solve the function naming problem, and we'd have more visibility of device page handling in more places in the kernel, which has educational value. Regards,   Felix > >> page = follow_page(vma, addr, >> - FOLL_GET | FOLL_MIGRATION | FOLL_REMOTE); >> + FOLL_GET | FOLL_MIGRATION | FOLL_REMOTE | FOLL_LRU); > Overly long line here. > >> +/* >> + * NOTE: Technically this should goto check_pfn label. However, page->_mapcount >> + * is never incremented for device pages that are mmap through DAX mechanism >> + * using pmem driver mounted into ext4 filesystem. When these pages are unmap, >> + * zap_pte_range is called and vm_normal_page return a valid page with >> + * page_mapcount() = 0, before page_remove_rmap is called. >> + */ > Please properly indent comments. > >> + * zone, as long as the pte's are present and vm_normal_lru_page() succeeds. These >> * pages also get pinned. > Another overly long line here.