Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp5872048ybi; Tue, 4 Jun 2019 13:52:16 -0700 (PDT) X-Google-Smtp-Source: APXvYqx0fdwJCAO6UVYOfsUE/HcrNPJWHNlz68zv7/7Or5MSxOgMcOljDlof0/Qgq9CEZBfaITt6 X-Received: by 2002:a17:90a:71cb:: with SMTP id m11mr37836815pjs.40.1559681536733; Tue, 04 Jun 2019 13:52:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559681536; cv=none; d=google.com; s=arc-20160816; b=ihqcBeI7vLwlV5kdzaiBbaLKWAMgQZTJqG/LQ7TPpkjkfAvupPez3ZGsiWeRM7zvW5 5VfZjxqyTZa+VlKjqTcEb0szv2cVPVLByYmh7ZH9IGQvtYxaMTVbEVgcXyW+5wG2OC5X seBjIQykDuYlyURzHDpUrVBLzuPf1lF6SrDiEebgcnjaz+qlXjWkD4nFDU2XnBXmPlFu AIMeDJ4Pf3RXlqCu2adfYR7I5mLqwIHJALrv1UVUfjWl7gGF6erjMO0JMJLHU/4iMUj/ KGmW/uKKt4sQHdxMkeZb9DadlyezYvjqD5jytz+5kQ0631C3+X4rCmGMyBdvSxQPqZA6 6/ug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=SuLWDoC/s8/821tRl+sVU8TRKA4t4pcUdnJu/eqSVxA=; b=u9lhp0omd7Q+3BO0qVrZGF705k/nyccfpqo0hv7rDqqDLqIZyVkLxfpSJQyHiJ5ZDb piAidwpHpd8+605UG74h3Boqs0aZDt9+GPOS1+x/NShn+hXymL++KQGkMpKypDN+uulE QnoL9ESeRR63AKw0DTOqOQwAQ+BOy4vYU/1kFQvMyku0OUyTiAkf9eDyKqzacpoMLo5f 4lDngy2gB9rE+UAldXU0Zm2q/udG3KL49EN1FTr8OEjVjlcSRLZ0A3/Y/8pAyZav+JMD D6L3sHpS0ICA5JrCofYzodRt7DPf8E++HKgwh5h8hmG4DwCITJeaZ8U9d73aagdPRXOx QWgQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id z16si22772150pgg.91.2019.06.04.13.51.59; Tue, 04 Jun 2019 13:52:16 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1726593AbfFDUbk (ORCPT + 99 others); Tue, 4 Jun 2019 16:31:40 -0400 Received: from mga12.intel.com ([192.55.52.136]:3131 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726343AbfFDUbi (ORCPT ); Tue, 4 Jun 2019 16:31:38 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Jun 2019 13:31:38 -0700 X-ExtLoop1: 1 Received: from iweiny-desk2.sc.intel.com ([10.3.52.157]) by orsmga004.jf.intel.com with ESMTP; 04 Jun 2019 13:31:37 -0700 Date: Tue, 4 Jun 2019 13:32:47 -0700 From: Ira Weiny To: John Hubbard Cc: Dan Williams , Andrew Morton , Michal Hocko , Linux MM , Linux Kernel Mailing List , =?iso-8859-1?B?Suly9G1l?= Glisse Subject: Re: [PATCH v3] mm/swap: Fix release_pages() when releasing devmap pages Message-ID: <20190604203247.GB3980@iweiny-DESK2.sc.intel.com> References: <20190604164813.31514-1-ira.weiny@intel.com> <4d97645c-0e55-37c0-1a16-8649706b9e78@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4d97645c-0e55-37c0-1a16-8649706b9e78@nvidia.com> User-Agent: Mutt/1.11.1 (2018-12-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 04, 2019 at 01:17:42PM -0700, John Hubbard wrote: > On 6/4/19 1:11 PM, Dan Williams wrote: > > On Tue, Jun 4, 2019 at 12:48 PM John Hubbard wrote: > >> > >> On 6/4/19 9:48 AM, ira.weiny@intel.com wrote: > >>> From: Ira Weiny > >>> > ... > >>> diff --git a/mm/swap.c b/mm/swap.c > >>> index 7ede3eddc12a..6d153ce4cb8c 100644 > >>> --- a/mm/swap.c > >>> +++ b/mm/swap.c > >>> @@ -740,15 +740,20 @@ void release_pages(struct page **pages, int nr) > >>> if (is_huge_zero_page(page)) > >>> continue; > >>> > >>> - /* Device public page can not be huge page */ > >>> - if (is_device_public_page(page)) { > >>> + if (is_zone_device_page(page)) { > >>> if (locked_pgdat) { > >>> spin_unlock_irqrestore(&locked_pgdat->lru_lock, > >>> flags); > >>> locked_pgdat = NULL; > >>> } > >>> - put_devmap_managed_page(page); > >>> - continue; > >>> + /* > >>> + * Not all zone-device-pages require special > >>> + * processing. Those pages return 'false' from > >>> + * put_devmap_managed_page() expecting a call to > >>> + * put_page_testzero() > >>> + */ > >> > >> Just a documentation tweak: how about: > >> > >> /* > >> * ZONE_DEVICE pages that return 'false' from > >> * put_devmap_managed_page() do not require special > >> * processing, and instead, expect a call to > >> * put_page_testzero(). > >> */ > > > > Looks better to me, but maybe just go ahead and list those > > expectations explicitly. Something like: > > > > /* > > * put_devmap_managed_page() only handles > > * ZONE_DEVICE (struct dev_pagemap managed) > > * pages when the hosting dev_pagemap has the > > * ->free() or ->fault() callback handlers > > * implemented as indicated by > > * dev_pagemap.type. Otherwise the expectation > > * is to fall back to a plain decrement / > > * put_page_testzero(). > > */ > > I like it--but not here, because it's too much internal detail in a > call site that doesn't use that level of detail. The call site looks > at the return value, only. > > Let's instead put that blurb above (or in) the put_devmap_managed_page() > routine itself. And leave the blurb that I wrote where it is. And then I > think everything will have an appropriate level of detail in the right places. I agree. This leaves it open that this handles any special processing which is required. FWIW the same call is made in put_page() and has no comment so perhaps we are getting wrapped around the axle for no reason? Frankly I questioned myself when I mentioned put_page_testzero() as well. But I'm ok with Johns suggestion. My wording was a bit "rushed". Sorry about that. I wanted to remove the word 'fail' from the comment because I think it is what caught Michal's eye. Ira > > > thanks, > -- > John Hubbard > NVIDIA >