Message ID | 20230628215310.73782-5-peterx@redhat.com (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id A1888EB64DA for <linux-mm@archiver.kernel.org>; Wed, 28 Jun 2023 21:53:27 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0A80B8D0008; Wed, 28 Jun 2023 17:53:27 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 058548D0001; Wed, 28 Jun 2023 17:53:26 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D9F428D0008; Wed, 28 Jun 2023 17:53:26 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id CC0328D0001 for <linux-mm@kvack.org>; Wed, 28 Jun 2023 17:53:26 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id A8D211A030B for <linux-mm@kvack.org>; Wed, 28 Jun 2023 21:53:26 +0000 (UTC) X-FDA: 80953508412.21.84BE2E2 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf28.hostedemail.com (Postfix) with ESMTP id 6FBECC0023 for <linux-mm@kvack.org>; Wed, 28 Jun 2023 21:53:23 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=KeboY+yW; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf28.hostedemail.com: domain of peterx@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=peterx@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1687989203; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=C1A4ivN2AFC1lD1f3DRS9KX47rVe/ku79YHFPXkOfKI=; b=Jn11f6bAlphf/J+xebsfidABl2WedJCfMYWWbVAD8AsMoNTQKYDV7FYt8V9SrSawuZnkFS o3trCo68OaNtZyC5jFq4Y73q4p104AeMzUBKpex4Dyn+PzUDkel5Pv15EQdLIalyjOI0Ty LIAiIXqUJ6sgfDcv8PjB1X2kgh/sTNo= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=KeboY+yW; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf28.hostedemail.com: domain of peterx@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=peterx@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1687989203; a=rsa-sha256; cv=none; b=0OS0QhtzuWOLsxPBWl1oUICWrt+NENXAJ2f+d0PA2xRo/EmFOwd4HSzTc06sbb4ybTZwda uwybgIkaYt5TZeGENCmIMVkN5SuMhlV6hQMcxTe+gLV0cIKYetyk5WArcGsY9GGKXFqaCe jrxvHBDhzhn4kq+oP9ejAImCG8qLbOI= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687989202; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=C1A4ivN2AFC1lD1f3DRS9KX47rVe/ku79YHFPXkOfKI=; b=KeboY+yWnMKPcw2c9tAxR3tXXzaV350QaS30sgj7axrBoxG85ZTstcCfZmBmz/o0rM5vA8 2rgQmsKBs5+E0i+G2kuCvmUrakR8NcS+Qt5pc0Yv3nz5LoOK60fPUtE9W84zZOrL+1P7ht +HEI33J9VrqWaGGFw53Cyu9qIlj+9nM= Received: from mail-qt1-f198.google.com (mail-qt1-f198.google.com [209.85.160.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-619-RVyHkiDJPFOXqajzmPxoTg-1; Wed, 28 Jun 2023 17:53:20 -0400 X-MC-Unique: RVyHkiDJPFOXqajzmPxoTg-1 Received: by mail-qt1-f198.google.com with SMTP id d75a77b69052e-4009ad15222so27711cf.1 for <linux-mm@kvack.org>; Wed, 28 Jun 2023 14:53:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687989198; x=1690581198; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=C1A4ivN2AFC1lD1f3DRS9KX47rVe/ku79YHFPXkOfKI=; b=ZBcbwG2VFSZPVlk/QXDvfqG0JhfB74wGE2Zzu+nXVGzJU8w4V6bOKKjNkz50cTblxr LgYBWHpXdNMBgHnkORlfQrkTS1Okl4LodllAbZXdrg0dqQFgBx6foh+VWeYvJDeWGLpt iYWO/zMK3si4s6lQRGOfv1dcSglj8JwkLq/T+4l+l83RC/BN/EUB7n0EdO9P4Wr/0zS6 j1VZoBbNd+gwDB9KLslQLDPJGmnhYAnzDyPi0JIVEjAERtw10JxeRYy7Mzgqgo/hq2em i6tAnYpK6zomBV2zY5Pml45m5CS3XDAO0oH1feJPMloTCQ3bX50PX2kd8PV17efaIOl7 TTcQ== X-Gm-Message-State: AC+VfDxsXUGak9PqnnR/XhcJrXytAz0sk+tHxcx2/h2o8WisDXmwhlM2 POx/NxGY2+eI9PrQQxye1paeyuRcozbNcyxT4TRxiEFVpGOFc/4aDitSQm4727aLAYNMrwC0Rpn BVFif42IboAy0eOYjhzv32EZc5zF4pgd0GzERibx7b+U8EE2ppjJ+owFj9dLJFzoEv2Ty X-Received: by 2002:a05:6214:301a:b0:635:da19:a67f with SMTP id ke26-20020a056214301a00b00635da19a67fmr13098208qvb.1.1687989198128; Wed, 28 Jun 2023 14:53:18 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4bWthzbIpu8brAzYWFel0vezukPFHw5JtwGCHRd23ZlsKMqKd/fjN3mRP22Dyi1lIzaJO53Q== X-Received: by 2002:a05:6214:301a:b0:635:da19:a67f with SMTP id ke26-20020a056214301a00b00635da19a67fmr13098180qvb.1.1687989197705; Wed, 28 Jun 2023 14:53:17 -0700 (PDT) Received: from x1n.. (cpe5c7695f3aee0-cm5c7695f3aede.cpe.net.cable.rogers.com. [99.254.144.39]) by smtp.gmail.com with ESMTPSA id p3-20020a0cfac3000000b00631fea4d5bcsm6277797qvo.95.2023.06.28.14.53.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Jun 2023 14:53:17 -0700 (PDT) From: Peter Xu <peterx@redhat.com> To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: David Hildenbrand <david@redhat.com>, "Kirill A . Shutemov" <kirill@shutemov.name>, Andrew Morton <akpm@linux-foundation.org>, Andrea Arcangeli <aarcange@redhat.com>, Mike Rapoport <rppt@kernel.org>, John Hubbard <jhubbard@nvidia.com>, Matthew Wilcox <willy@infradead.org>, Mike Kravetz <mike.kravetz@oracle.com>, Vlastimil Babka <vbabka@suse.cz>, Yang Shi <shy828301@gmail.com>, James Houghton <jthoughton@google.com>, Jason Gunthorpe <jgg@nvidia.com>, Lorenzo Stoakes <lstoakes@gmail.com>, Hugh Dickins <hughd@google.com>, peterx@redhat.com Subject: [PATCH v4 4/8] mm/gup: Cleanup next_page handling Date: Wed, 28 Jun 2023 17:53:06 -0400 Message-ID: <20230628215310.73782-5-peterx@redhat.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230628215310.73782-1-peterx@redhat.com> References: <20230628215310.73782-1-peterx@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-Rspamd-Queue-Id: 6FBECC0023 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: gxaoc6kjtk9shmgpw1f7xi44puywj739 X-HE-Tag: 1687989203-197959 X-HE-Meta: U2FsdGVkX1/s2J7bvXe0no06nxoE9t5mxpx0kYnbuK4jHeOPEH6odA6pQjbPHAjRrNfBkTyK+nkufq6p1V+KOTk+V+6i0x1LH7L0z+oC5RRT2d8Y9JcW87RiGp+8VWb1AEBxT58N1TccLxyB7YZFPnUPMlJz5iorlCmNy3R+TNoEEh3M4ZkcYr/soKuBgCqmCJCfP4sKLnupOPeLDM3o4Ftp/9RU48Bl3fJZa0T/XrRtkLj8htbKo3HSI7O2RB8FyoW312TvLdJH26JBWKaGb5fd9Z36mLuSvaG2urf4L0+cfSUNKvxnak2sNmdBpq7ixGqyH6Wicv3V2bzbKjZSz+iiF865/7HDhbGf5HyAU4kBqz1iLEo4t0E/kmSBtwHG8OXnRa9N4xIws+i+4WyK9fJNuhbtLCC+yQJgdfGXZlgPrk2Q5Vk9GitoI5DLSN29SzIAutt9wcTCMtBTVeyzYq9yf997oRIsMj0gPSba77xe7HfJ+pUi8tVt54krUURvFYfhHM89NEJ0ad1ngKAzrcnJkHX0V5CqV3pQ4eNH6hvGx7MUtx1Twzj5KbMsQju3N0xcu+HFdd1Cyl2Td6IFEqG+s3jXJ2553uGKEGgcTbUvczLi4XlnaDL0i3IVFhBHwY3OawSpw1/7vh2v1JM/PO4z3w6DAwu5NaQaVQXuAlDKGmgO/KuwBnqjUDBvfJ/lQygrdbfOeVuzZyDQYzIp2GGOgppKY+rSGlJRTvHfGxegH+eRYFLmg6exCCJT2byPBYmJFWS/OO3NTO+O9fnFqbiFEAf2mM1vcYnxZFWFgmHnU2BUtiTLowUxZEsthE1z0koH5jSD+Spt5XmA6w2lRw+tJ5oXnFKhKD7Itaq+QoDXPZ8Jq5cjlAfZQDEGcCJopt+wJwkRg+eQC72KemMm0KEaSkPC67PYwwfOPCVv/k2Bq6o8mZ8AozUD1P0DZUUo7rwGq81ctImsmn8EWwY +d9b9Kq3 sIbc3N3sPZAkoFWQCoVhKzFkVRAIYoLJBXFWsk0zjFgK8WX3MhdA9XreC3tApqQBfh55E5OfJYlRJcZ9mOEW2tctiFP/9T6WXSt+tIZJcETWuL3Xc4SKFs5l0gvJyR82DCy7DOUTugpLP+cQMhSGncz/gkXoKlUgrlV35GUrvZ6xd5VCXm6VNGgveYlLODb7VjPwy4cDJAeiByvjD1qkG3zOiauIDmz/Rz/Y/eV6LNGQF1MXxwhC+gvVBJmMz0aiqcVp+aQ9llIaLoDJRnCO7w8xuvQrjjVl1sIENZeDaB2DekT4FtzhtMBkd4VqAxiRRInKJoxrdpaqBNBiMWRGXgcAGbGQUctwZu+hB82aBARsg1OqL2phJAGE5Mzui292O66AYAtxD2vNg8sasWU2lO1Gipwh4hvEPsA+66INadflTKxA6NnZOsm/0vwMgowdqXuQC578c4NJYbHo= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: <linux-mm.kvack.org> |
Series |
mm/gup: Unify hugetlb, speed up thp
|
expand
|
diff --git a/mm/gup.c b/mm/gup.c index 1e2e23084f3c..5af1be81390b 100644 --- a/mm/gup.c +++ b/mm/gup.c @@ -1124,7 +1124,7 @@ static long __get_user_pages(struct mm_struct *mm, if (!vma && in_gate_area(mm, start)) { ret = get_gate_page(mm, start & PAGE_MASK, gup_flags, &vma, - pages ? &pages[i] : NULL); + pages ? &page : NULL); if (ret) goto out; ctx.page_mask = 0; @@ -1194,19 +1194,18 @@ static long __get_user_pages(struct mm_struct *mm, ret = PTR_ERR(page); goto out; } - - goto next_page; } else if (IS_ERR(page)) { ret = PTR_ERR(page); goto out; } +next_page: if (pages) { pages[i] = page; flush_anon_page(vma, page, start); flush_dcache_page(page); ctx.page_mask = 0; } -next_page: + page_increm = 1 + (~(start >> PAGE_SHIFT) & ctx.page_mask); if (page_increm > nr_pages) page_increm = nr_pages;