Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp464473ybb; Fri, 20 Mar 2020 02:20:32 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtTWv7NVCFIlMnkFBwxg6GOdOvKIzHttjb+AUHDZ5P4uhXnHf+pvW9pjD9IKBbjGBij6smU X-Received: by 2002:a9d:7085:: with SMTP id l5mr5616940otj.53.1584696032150; Fri, 20 Mar 2020 02:20:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584696032; cv=none; d=google.com; s=arc-20160816; b=eGGQVFYFKgHUiQxdaUWXT4h/wQc/IqbNosOkTDody9+RHz4of0/CtR5Mp3YuVQJZDF +v5nrwsDcmOoC6tBYuOrzyPB4DX699J4OUEwcw/F+v31AHjuETS3NM40kAqAC2QC2uWR mD7ECp5KxHiFbTvJLf7gHu0XXglRkFEa+RPHNayL4nVdkXHwP8t+gcmrieE8hChxwlno QzVNTLWQY+0zhw1gtVzncNI3cqcDHg5wW2vQey+1liRQiDBGIdN9VrAlXNTzOuIEUUdB voYFJzbAvU4hcVhAb4SAawOauLGzLYPqE/j++2qS42o0sJvZkrxCq4fhmNBDH0wW5R1L dfDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=uJsVOgGPqb/q2iRd8gn1ZD5qGfpeyHF3Le1yJsRuXmA=; b=QbCXEBrnsDqgrxFvIq0Bgi3cX0eSr+hCH9h4tjiwjCzxGsmRVr5mtehmc/MCaRCKzh 9ktRIEuzg7L74TshLbkOsoQcgaSlpVow59mAbVs4NWopBIB6ahHqghDL+UEhqCkkcuzm zHnn5Q/04Dc+CVyTRqjEXOY7ovUhXXdMDEMUmVWNzHJx+/w6m56+3fuIFd9CNjIFY+oy mv9mhwUONWVI/GYXJmx/qE+NTHTFHViH84OzgMp2SyQsOvZJb1KKXKoRLjDKwfllyOBP hhSWmHltsNSMpdnEeQzdrIA5iGfl3oYd0dWGa5yHnZMlnGXI/bR52Zlvkp5DPiUVA4sX bFqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=P40kBnaT; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w16si2896929otl.217.2020.03.20.02.20.19; Fri, 20 Mar 2020 02:20:32 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=P40kBnaT; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726896AbgCTJT6 (ORCPT + 99 others); Fri, 20 Mar 2020 05:19:58 -0400 Received: from mail-io1-f53.google.com ([209.85.166.53]:34154 "EHLO mail-io1-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726527AbgCTJT6 (ORCPT ); Fri, 20 Mar 2020 05:19:58 -0400 Received: by mail-io1-f53.google.com with SMTP id h131so5267017iof.1 for ; Fri, 20 Mar 2020 02:19:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=uJsVOgGPqb/q2iRd8gn1ZD5qGfpeyHF3Le1yJsRuXmA=; b=P40kBnaTd399NxpP8B3CDrW2EqNichDXtrwhLFk1eoZSf2Xyn5OM0CPypIcVOaDqSp +x1x31mXzMGtZkwDScNBn5nCcLTPCQJSRzy6q3EedUh6RzFglQmEhIH2jqqL60HGKPih /o6GdHksAfcosoZUgZo9fMBLQTmQECxCj8ZeJbLpSk+YHw4SR3PPewjR0BQKJjLVyRE1 SlPBPoJwZmRSWyEZXQ1AuClL3fFUywRZRG9K+ZzgMMkLhJq29ZnrTcnnUCq7HZyQR2dA 4acUhas9LpD3+GvA+Qlq1yXuoug0IYoGmlbiTIPu2C6nuXHPXDyem9mBZS7LP2+GydiM r/iA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=uJsVOgGPqb/q2iRd8gn1ZD5qGfpeyHF3Le1yJsRuXmA=; b=UW9qlSdayQOPuWcHIpjZ3cDvazHTa1qe8dFoK6AdFZDcNbkgeCNKd62hsODHy0Ty6S f33pbPcRC0vHBu35fxUqK0iOmR5VvhoQIQTM4eA1me85KR9a3Hphxcnez4LdwrXD/bNR zDZ83eYlZ2wYCTBiHjAsbEU8neeRdzsi5YSRRypmUEguF3RXyBKu+Q69wtyxMrMIfBNF FQJeq1DoSQM47DCFw1bfa2lRmVaSMgKstwtQv6ZphP5/2YJsQu7mXEfTFyWdXKFQaY1h kzSJ4SCtJZ72REwr1WRNFOamS7jrVF1zhK4CbatoUEymIbhjylSEbRY2O06y+krW9w4U pZ7Q== X-Gm-Message-State: ANhLgQ3WosOUg9WKmGvzaSuatIZDPURK2B7a0cX15chQwwNFA2Q4mgCF 4SZxs77AX5ZWGXuv/S/FyYsY5tGV/eQ5hmel+A== X-Received: by 2002:a5e:d512:: with SMTP id e18mr6593451iom.209.1584695997679; Fri, 20 Mar 2020 02:19:57 -0700 (PDT) MIME-Version: 1.0 References: <1584333244-10480-3-git-send-email-kernelfans@gmail.com> <1584445652-30064-1-git-send-email-kernelfans@gmail.com> In-Reply-To: From: Pingfan Liu Date: Fri, 20 Mar 2020 17:19:46 +0800 Message-ID: Subject: Re: [PATCHv7 2/3] mm/gup: fix omission of check on FOLL_LONGTERM in gup fast path To: John Hubbard Cc: Linux-MM , Ira Weiny , Andrew Morton , Mike Rapoport , Dan Williams , Matthew Wilcox , "Aneesh Kumar K.V" , Christoph Hellwig , Shuah Khan , Jason Gunthorpe , LKML Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Mar 20, 2020 at 6:17 AM John Hubbard wrote: > > On 3/17/20 4:47 AM, Pingfan Liu wrote: > > FOLL_LONGTERM is a special case of FOLL_PIN. It suggests a pin which is > > going to be given to hardware and can't move. It would truncate CMA > > permanently and should be excluded. > > > > In gup slow path, slow path, where > > > s/slow path, slow path/slow path/ Yeah. [...] > > > > /* > > + * Huge page's subpages have the same migrate type due to either > > + * allocation from a free_list[] or alloc_contig_range() with > > + * param MIGRATE_MOVABLE. So it is enough to check on a subpage. > > + */ > > Urggh, this comment is fine in the commit description, but at this location in the > code it is completely incomprehensible! Instead of an extremely far-removed tidbit about > interactions between CMA and huge pages, this comment should be explaining why we bail > out early in the specific case of FOLL_PIN + FOLL_LONGTERM. And we don't bail out for > FOLL_GET + FOLL_LONGTERM... > > > I'm expect it is something like: > > /* > * We can't do FOLL_LONGTERM + FOLL_PIN with CMA in the gup fast > * path, so fail and let the caller fall back to the slow path. > */ > > > ...approximately. Right? Yes, right. And I think it is better to drop "We". Thanks, Pingfan