Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3761798pxk; Tue, 22 Sep 2020 01:38:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw0SVldHQzGCPWo6MLnGqXdgyD1kAPxF1Dlc1r5P5eSYPmG0ZFCYMRacrFP9VSfPVY+d+bN X-Received: by 2002:a17:906:8143:: with SMTP id z3mr3604415ejw.323.1600763929852; Tue, 22 Sep 2020 01:38:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600763929; cv=none; d=google.com; s=arc-20160816; b=vyziAkgdo8Qfhs+i6OI9h/pNkJAAJbfbkDB5JtklJk7aGrIY3XEV70KLNRhsEA/p00 rkRMFhqUvIF/vf6GanhCR9RUpR1qBXxZs9t13QT5MdHa6A76kfYam9lqOVH5QvSp6UT4 6CCpnK2G+RGAuQb0qbxGDMk/eqs9nbCsYKD0JgtteGxjXLh5MrowobFWWPoscAKVP/9V mtyDXreH0effFm3TbtZStLfd9DArOZkyf5ELICyeJ812/7XPN7VqVNKxVpByv5N9fk5F c3mGGAMFBJP+Mdb2luDvCWUbFDdfX7iDMARY7wh/i3z4qdjiUX2K+dHTEF0l4aLyh+l8 FOPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:organization :from:references:cc:to:subject:ironport-sdr:ironport-sdr; bh=xEhSHykssqhxl/5AfRhp6pvLqDEn2GXZdMiECEIr9kc=; b=z0Vkf4Z9Fv+OmN4yfEKGycpXLvsK885vWboKggVJ7rR2MM9M9KUjY3b0i/hz20bsPY EBlOV3FQLXFQZH/c1wt1NwE+I8JnGZ1dSXzrr0FaOCeQQcYkXsaed9A5T0JLjTLmUj1D GdAEd9G9gK+4KsWB/9V4to8jJh6oMw2q7qiJG8+j50UTqByltNGY0XX6jhIZcaCo8xmI oxkCfn/ttbH8tEBqyeOO6ql9VHD7Te21hY8wixDQvkVtW+gSFcY/uh58YRmPCnVvvnXI j7m8B4Z7pp9B08nWgG6jsTQhOi7LdhvdWiDuBQukvFqBWPYPPATQEkQDt+ZEcV+Py0Jd 7JHA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e7si3047824edv.70.2020.09.22.01.38.26; Tue, 22 Sep 2020 01:38:49 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726691AbgIVIZQ (ORCPT + 99 others); Tue, 22 Sep 2020 04:25:16 -0400 Received: from mga06.intel.com ([134.134.136.31]:44343 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726483AbgIVIYJ (ORCPT ); Tue, 22 Sep 2020 04:24:09 -0400 IronPort-SDR: qk+tlc/MYUqMS/0sSiFxa5UDTD+BgM0SwENAafdxKBPIi2rxAefbdHoYnP19aTUzr2iJlGqMKH Yk06wQ8H8rsw== X-IronPort-AV: E=McAfee;i="6000,8403,9751"; a="222152847" X-IronPort-AV: E=Sophos;i="5.77,290,1596524400"; d="scan'208";a="222152847" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Sep 2020 01:24:08 -0700 IronPort-SDR: hYPYeshgQ9gLbxA+nGdC2UUT7a+sUMfvmmOdnILx1oZilih/OM+HLuWniJZ+KnDxCiUxxvah+K LMJGx+/weQGQ== X-IronPort-AV: E=Sophos;i="5.77,290,1596524400"; d="scan'208";a="454404248" Received: from atroib-mobl2.ger.corp.intel.com (HELO [10.214.238.184]) ([10.214.238.184]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Sep 2020 01:24:02 -0700 Subject: Re: [Intel-gfx] [PATCH 3/6] drm/i915: use vmap in shmem_pin_map To: Christoph Hellwig , Matthew Wilcox Cc: Juergen Gross , Stefano Stabellini , linux-mm@kvack.org, Peter Zijlstra , Boris Ostrovsky , x86@kernel.org, linux-kernel@vger.kernel.org, Minchan Kim , dri-devel@lists.freedesktop.org, xen-devel@lists.xenproject.org, Andrew Morton , intel-gfx@lists.freedesktop.org, Nitin Gupta , Chris Wilson , Matthew Auld References: <20200918163724.2511-1-hch@lst.de> <20200918163724.2511-4-hch@lst.de> <20200921191157.GX32101@casper.infradead.org> <20200922062249.GA30831@lst.de> From: Tvrtko Ursulin Organization: Intel Corporation UK Plc Message-ID: <43d10588-2033-038b-14e4-9f41cd622d7b@linux.intel.com> Date: Tue, 22 Sep 2020 09:23:59 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20200922062249.GA30831@lst.de> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 22/09/2020 07:22, Christoph Hellwig wrote: > On Mon, Sep 21, 2020 at 08:11:57PM +0100, Matthew Wilcox wrote: >> This is awkward. I'd like it if we had a vfree() variant which called >> put_page() instead of __free_pages(). I'd like it even more if we >> used release_pages() instead of our own loop that called put_page(). > > Note that we don't need a new vfree variant, we can do this manually if > we want, take a look at kernel/dma/remap.c. But I thought this code > intentionally doesn't want to do that to avoid locking in the memory > for the pages array. Maybe the i915 maintainers can clarify. + Chris & Matt who were involved with this part of i915. If I understood this sub-thread correctly, iterating and freeing the pages via the vmapped ptes, so no need for a shmem_read_mapping_page_gfp loop in shmem_unpin_map looks plausible to me. I did not get the reference to kernel/dma/remap.c though, and also not sure how to do the error unwind path in shmem_pin_map at which point the allocated vm area hasn't been fully populated yet. Hand-roll the loop walking vm area struct in there? Regards, Tvrtko