Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp251491ybf; Sat, 29 Feb 2020 02:51:52 -0800 (PST) X-Google-Smtp-Source: APXvYqzI2f18VZo9CgdQlYolzkuZzwjk4oZEixc3HsmKphgj3vVQVuj5B7xmFGJSfX4sr4Syfm6E X-Received: by 2002:a05:6830:1353:: with SMTP id r19mr6594677otq.288.1582973512519; Sat, 29 Feb 2020 02:51:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582973512; cv=none; d=google.com; s=arc-20160816; b=pnIgBQVzpwoAG/JotFNkilghOPipjddTXQTcvHFD/RVleJJhqJmA31mNLwXIZOtPF0 El0d8kccxF8YG9VdhvhWaLM4tKviZUD6WGulqR8qmTjqJF6ofdDAjfs9KfT0tARNji6b K+9FcaH0OT744yQ61EDLclnHx+OemlOJxGoVq5BYwGJjpU6Qy+HHbzW8KTdDscb0RhIc YA1e9o2SPR+iORZBK9ASW0stoVvwRtiWVctJOZUdSc/yn6A6SZnovhpRAcynvDnpsl+3 l6xWzR+6XhyUrzhng/fd4DE1rEP+1pn6KQBG16hbGlIGzhYpQVZGE8h0Nmm6/CFCulzF 5alQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:content-transfer-encoding :mime-version:organization:references:in-reply-to:subject:cc:to:from :date; bh=rRM1GzgoG9mJAseLMUxFiO4MNRVEr+M168VjIOp+JGk=; b=qo8CtsAQkfXV05QlKcCH89W1qSfJo0QFzbCQ95icx63jGdKviDWwLH3DJ9Po3zkYWa U0fAdY9L2EkNSADil1kSX4AD3xDEcevQUN/tsB+1dNigcG6iwbQOsaFmcCFy/3QseXDH Q1+U0BaHLNZGQ9qRBHbTsHcOgA5hr9a4ZKl7NFEyHihrp2r3za9Q0zWeugxrn1iCoLxp ZXHUb+FeWrP2D1ryg0PUSOh7FA2n0AmSSSC4OVZMBVJx8joi1fOyjSHiuT/7wFcQsjHA zh5l89PKs4ZKOZfDUR+A3UZE+fEM97zA1mU9qlVXWbf0i2BAWr/DdQIljwkLiXyNQpJQ d5mQ== 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=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m12si3122037oim.195.2020.02.29.02.51.41; Sat, 29 Feb 2020 02:51:52 -0800 (PST) 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=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726843AbgB2Kvc (ORCPT + 99 others); Sat, 29 Feb 2020 05:51:32 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:57642 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725747AbgB2Kvc (ORCPT ); Sat, 29 Feb 2020 05:51:32 -0500 Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 01TApQin030420 for ; Sat, 29 Feb 2020 05:51:31 -0500 Received: from e06smtp01.uk.ibm.com (e06smtp01.uk.ibm.com [195.75.94.97]) by mx0a-001b2d01.pphosted.com with ESMTP id 2yfmu1t2xs-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Sat, 29 Feb 2020 05:51:30 -0500 Received: from localhost by e06smtp01.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Sat, 29 Feb 2020 10:51:28 -0000 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) by e06smtp01.uk.ibm.com (192.168.101.131) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Sat, 29 Feb 2020 10:51:24 -0000 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 01TApMq732833554 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 29 Feb 2020 10:51:22 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8A57D5204E; Sat, 29 Feb 2020 10:51:22 +0000 (GMT) Received: from p-imbrenda (unknown [9.145.2.1]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id E264D52051; Sat, 29 Feb 2020 10:51:21 +0000 (GMT) Date: Sat, 29 Feb 2020 11:51:19 +0100 From: Claudio Imbrenda To: John Hubbard Cc: , , , , , , , , , , Jan Kara , "Kirill A. Shutemov" Subject: Re: [RFC v1 1/2] mm/gup: fixup for 9947ea2c1e608e32 "mm/gup: track FOLL_PIN pages" In-Reply-To: References: <20200228154322.329228-1-imbrenda@linux.ibm.com> <20200228154322.329228-3-imbrenda@linux.ibm.com> Organization: IBM X-Mailer: Claws Mail 3.17.4 (GTK+ 2.24.32; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 x-cbid: 20022910-4275-0000-0000-000003A69892 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 20022910-4276-0000-0000-000038BB352E Message-Id: <20200229115119.3562c73e@p-imbrenda> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138,18.0.572 definitions=2020-02-29_03:2020-02-28,2020-02-29 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 suspectscore=0 spamscore=0 malwarescore=0 adultscore=0 mlxlogscore=999 bulkscore=0 mlxscore=0 impostorscore=0 clxscore=1015 phishscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2001150001 definitions=main-2002290084 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 28 Feb 2020 15:08:35 -0800 John Hubbard wrote: > On 2/28/20 7:43 AM, Claudio Imbrenda wrote: > > In case pin fails, we need to unpin, a simple put_page will not be > > enough > > > > Signed-off-by: Claudio Imbrenda > > --- > > mm/gup.c | 5 ++++- > > 1 file changed, 4 insertions(+), 1 deletion(-) > > > > diff --git a/mm/gup.c b/mm/gup.c > > index f589299b0d4a..0b9a806898f3 100644 > > --- a/mm/gup.c > > +++ b/mm/gup.c > > @@ -2134,7 +2134,10 @@ static int gup_pte_range(pmd_t pmd, unsigned > > long addr, unsigned long end, goto pte_unmap; > > > > if (unlikely(pte_val(pte) != pte_val(*ptep))) { > > - put_page(head); > > + if (flags & FOLL_GET) > > + put_page(head); > > + else if (flags & FOLL_PIN) > > + unpin_user_page(head); > > Hi Claudio, > > Instead, I think that should actually be: > > put_compound_head(page, 1, flags); that makes sense, yes :) I'll fix it in the next iteration > > which does a bit more (bug checks and /proc/vmstat instrumentation) > than your diff, but has the same basic idea: call the right "put" > function. > > ...oh, actually, I see you have the commit hash in the subject line. > Instead, it should be in the commit description. Let's maybe change > the subject line to approx: > > mm/gup: Fix a missing put_compound_head() call in gup_pte_range() > > And the write up...how about something like this, if you like it: > > > try_grab_compound_head() must be undone via put_compound_head(), not > put_page(). This was missed in the original implementation of the > gup/dma tracking patch, so fix it now. > > Fixes: 0ea2781c3de4 ("mm/gup: track FOLL_PIN pages") > > > > (Aside: I'm using the linux-next commit hash. How does one get the > correct hash before it goes to mainline? I guess maintainer scripts > fix all those up?) my idea was that my patch should be used as fix-up, so the actual content of the commit message is not relevant > It's also good to Cc some reviewers in case I'm overlooking > something, so I'm adding Jan and Kirill. > > thanks,