Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp932468yba; Thu, 4 Apr 2019 00:25:24 -0700 (PDT) X-Google-Smtp-Source: APXvYqxfPGr4IsJd/GaMFgvmlh5fPR4EHd2xqxMIKuGQJWEGdfIhqssHTjXdGDNBZnXXuVARtzpz X-Received: by 2002:a17:902:2a29:: with SMTP id i38mr4840734plb.22.1554362723966; Thu, 04 Apr 2019 00:25:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554362723; cv=none; d=google.com; s=arc-20160816; b=XGr0UnDCYHrrL2PEJXEtA2JXJi9yhxVUm0DMaukhF2l2QH9jTm+MJpqReGgzeiBGir +9jMIgtHFVaLPOuu753pmPAyolsrmmz5OVI/C9vC6cZV4b3PbUuc0HnssrsBjnsgGuQj +ZCKv0V1BjIsYXSXDzwZAU7bJ5fS0eqjjQwehZYOAlSzTKC42x4cvyC37KnysaSrtB6j pHPGCw6lGoHt8oHuAFu/8Ft2ApNn5wKIaii8vqS1hGrlUex7Fsq2h4VzIHK9Rp1pxImm HSjIyQc6YebqMYeuNprGYS/oMcUYQQO7GkWn/TlOB6o/vOo+jN9IeNEJWGEg0275i/DU B/lw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from:dkim-signature; bh=xx8VzHLiibMcDula0s0X91k44Awqbt6B1nRWsay/e1I=; b=PCNS8jk39S4NlY4XKIdPgpDXLFFcE1KZ7qIuvkO775n2mmgPp8sOIn05TiURCRyCxZ N2JBYBRkgecujjVb9gCdz7TvHOcYukrNcf2dpv/ffCiVhsv8Wp+LuuC3ev4KneztV6M6 0MzbkIn+5mJjgPPeqKScjnnWnHOw6P5dxzCTqsqWXpgc488CvEZUYfgM2zQl9c4F1SpO +J5ymtRCIfA21JTUozB26Cs6YYGzw+rJjvLhN5M2h24JmJhhcw5GUwrGi4tiOO1oHIoJ NjQgv16lZhmSqhGOUJJsFUTVLJl7K8pxDPBQ/yfsYPpYNADk5zsBisLe4Okcyx8goGZ9 hKtA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@iluvatar.ai header.s=key_2018 header.b=aToAwocn; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=iluvatar.ai Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b34si5396965pla.381.2019.04.04.00.25.09; Thu, 04 Apr 2019 00:25:23 -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=@iluvatar.ai header.s=key_2018 header.b=aToAwocn; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=iluvatar.ai Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727333AbfDDHYE (ORCPT + 99 others); Thu, 4 Apr 2019 03:24:04 -0400 Received: from owa.iluvatar.ai ([103.91.158.24]:5254 "EHLO smg.iluvatar.ai" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726058AbfDDHYE (ORCPT ); Thu, 4 Apr 2019 03:24:04 -0400 X-AuditID: 0a650161-773ff700000078a3-3a-5ca5b10f9ea3 Received: from owa.iluvatar.ai (s-10-101-1-102.iluvatar.local [10.101.1.102]) by smg.iluvatar.ai (Symantec Messaging Gateway) with SMTP id E2.73.30883.F01B5AC5; Thu, 4 Apr 2019 15:23:59 +0800 (HKT) Content-Type: text/plain DKIM-Signature: v=1; a=rsa-sha256; d=iluvatar.ai; s=key_2018; c=relaxed/relaxed; t=1554362639; h=from:subject:to:date:message-id; bh=xx8VzHLiibMcDula0s0X91k44Awqbt6B1nRWsay/e1I=; b=aToAwocnWLp6XN3hzTRRF7P4iGhB++m9K7y0l7+EMVvqrTgOUWvR9VtHyviIauiOyQm0dDC+4rk yaZJUnW93dnWEu4d3Rhi5/AnTCgRFNXB0zMu2xLk48h9iFvxYD9cr3NQ6+Iy3oNM0vwPgblRQfYO6 yDdzj+jMmBTil8ykwho= Received: from hsj-Precision-5520.iluvatar.local (10.101.199.253) by S-10-101-1-102.iluvatar.local (10.101.1.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1415.2; Thu, 4 Apr 2019 15:23:59 +0800 From: Huang Shijie To: CC: , , , , Huang Shijie Subject: [PATCH] mm/gup.c: fix the wrong comments Date: Thu, 4 Apr 2019 15:23:47 +0800 Message-ID: <20190404072347.3440-1-sjhuang@iluvatar.ai> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 X-Originating-IP: [10.101.199.253] X-ClientProxiedBy: S-10-101-1-102.iluvatar.local (10.101.1.102) To S-10-101-1-102.iluvatar.local (10.101.1.102) X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrALMWRmVeSWpSXmKPExsXClcqYpsu/cWmMweweHYs569ewWex/+pzF 4vKuOWwW99b8Z7XYuvcquwOrR+ONG2wei/e8ZPLY9GkSu8eJGb9ZPD5vkgtgjeKySUnNySxL LdK3S+DK2Nu4hLlgOV/FttYvrA2Mq7m7GDk5JARMJH70/GTqYuTiEBI4wSgx4d8CRpAEs4CE xMEXL5hBbBaBt0wSx+Z4QxS1Mkm0PVjEBJJgE9CQmHviLliRiIC8RNOXR+wgRcwCvYwS9xqm gRUJCxhK7Fz1n62LkQNokorEnaNiIGFeAXOJG+0vWSGukJdYveEAM0RcUOLkzCcsIOVCAgoS L1ZqQZQoSSzZO4sJwi6U+P7yLssERoFZSE6dhaR7ASPTKkb+4tx0vcyc0rLEksQivcTMTYyQ YE3cwXij86XeIUYBDkYlHt4fq5fECLEmlhVX5h5ilOBgVhLhdX0NFOJNSaysSi3Kjy8qzUkt PsQozcGiJM5bNtEkRkggPbEkNTs1tSC1CCbLxMEp1cCksJnNyiHsLO8EfgfPOK77U2wTDJ+x tJ3bV7j/4ea9Hms7TQITbwWc0nKSulCw6Se/Q5LvwZx/y6zlVO7OW7546yrjddtr1Q6/fWAv +vy6i4rLi0tSay+qHVhk8mDu3bYX8aEJGWdtvzGs5zL+usg/stV4Rnf2zzPyJxtNa+YWKAqY siQ86P562pM5Mn7NevcpecuinMvlp3wXrtP5H/Zo6kVjuevuZ65efpL/R3q/4ryLx1kmfpM3 5y0S/X/0zr0ZUoaSSdvS/Axfh5/embH87YYioXitas+9fy8K/LD245lmzsxdIK2ovLJkk8uf m4lahgfCm9n4RTMEtGfPtjdXk4iaI6LxNev/QibXV6eVWIozEg21mIuKEwEEoaWG0wIAAA== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When CONFIG_HAVE_GENERIC_GUP is defined, the kernel will use its own get_user_pages_fast(). In the following scenario, we will may meet the bug in the DMA case: ..................... get_user_pages_fast(start,,, pages); ...... sg_alloc_table_from_pages(, pages, ...); ..................... The root cause is that sg_alloc_table_from_pages() requires the page order to keep the same as it used in the user space, but get_user_pages_fast() will mess it up. So change the comments, and make it more clear for the driver users. Signed-off-by: Huang Shijie --- mm/gup.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mm/gup.c b/mm/gup.c index 22acdd0f79ff..b810d15d4db9 100644 --- a/mm/gup.c +++ b/mm/gup.c @@ -1129,10 +1129,6 @@ EXPORT_SYMBOL(get_user_pages_locked); * with: * * get_user_pages_unlocked(tsk, mm, ..., pages); - * - * It is functionally equivalent to get_user_pages_fast so - * get_user_pages_fast should be used instead if specific gup_flags - * (e.g. FOLL_FORCE) are not required. */ long get_user_pages_unlocked(unsigned long start, unsigned long nr_pages, struct page **pages, unsigned int gup_flags) @@ -2147,6 +2143,10 @@ int __get_user_pages_fast(unsigned long start, int nr_pages, int write, * If not successful, it will fall back to taking the lock and * calling get_user_pages(). * + * This function is different from the get_user_pages_unlocked(): + * The @pages may has different page order with the result + * got by get_user_pages_unlocked(). + * * Returns number of pages pinned. This may be fewer than the number * requested. If nr_pages is 0 or negative, returns 0. If no pages * were pinned, returns -errno. -- 2.17.1