From patchwork Thu Oct 24 08:42:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yang X-Patchwork-Id: 13848515 Return-Path: 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 1C90DD0BB70 for ; Thu, 24 Oct 2024 08:42:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6FF8A6B0085; Thu, 24 Oct 2024 04:42:56 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6AD026B0088; Thu, 24 Oct 2024 04:42:56 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 575406B0089; Thu, 24 Oct 2024 04:42:56 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 3BA2D6B0085 for ; Thu, 24 Oct 2024 04:42:56 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id BB440ACC09 for ; Thu, 24 Oct 2024 08:42:19 +0000 (UTC) X-FDA: 82707855342.28.D209CFB Received: from mail-ed1-f45.google.com (mail-ed1-f45.google.com [209.85.208.45]) by imf26.hostedemail.com (Postfix) with ESMTP id 9B8A814000D for ; Thu, 24 Oct 2024 08:42:40 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=RT4VB7ex; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf26.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.208.45 as permitted sender) smtp.mailfrom=richard.weiyang@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1729759249; a=rsa-sha256; cv=none; b=CQwhzdG/gJzRufdlSLgqVFpDtmnZm/0B0EzhduOsrYEUA2Baq/1zlLCR1ouZ04BIuNxI9k ElcYcSxqILA26OTO8UQfvae/cn9DPx4NZU7qiSgP/pSgJL7Z7t0DRrI+/COnVB1oxCs3br 4EaKqcvgVfc2UVCJewfoXn2CK6bKRgU= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=RT4VB7ex; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf26.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.208.45 as permitted sender) smtp.mailfrom=richard.weiyang@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1729759249; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references:dkim-signature; bh=USKI+yc5zGWMk7NxZkh0uKVcNiH3sZS1pFmuOkouVZI=; b=xcMXawJeScoRZKcC3tzGH2gl0Q/cJfcgQdvyO/3tjGsIsE3QWy6GmN4ehlx0UzZZVH5KQL 6sSCZ1beijmDs+q4uRxRIIJmH+/3Wv2ko5U4OGRC0jtunq2ushAB9i9WFO3Th8s5ygGVEp CzJt1O5hsE/hqnP4T6GErywDAPI5xeY= Received: by mail-ed1-f45.google.com with SMTP id 4fb4d7f45d1cf-5c94c4ad9d8so772356a12.2 for ; Thu, 24 Oct 2024 01:42:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729759373; x=1730364173; darn=kvack.org; h=message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=USKI+yc5zGWMk7NxZkh0uKVcNiH3sZS1pFmuOkouVZI=; b=RT4VB7exSwFGDldM/CupaKk+GNHhYMF60I+jhahieQ9FJsFPnDLI3Ji+c/Qxx7qNM2 bGtq3qTawiD5BtUsifoF2RuQwsIzM9O34kN1gSx28PqslIMHlFylIPjzzShniAacB94b thYmX+p8YM8z5ujKFckpTFZbosqfz9fsQEzhO4Ztq1ybZbsZK10gfFqvsGleV2S4lFiw q758hLomRbCgm9H6L7dXnd73MwsElkfO+VbBt9CPO1gZUh8yt0Jqj0AuUQuvnVZVTw1f e9BH53FptTqQMsU+ewWFSU0LoX6GcJ5GgNnEbkLCJsxNRkqUGMbqjERwGC8/Scti9WNt FbUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729759373; x=1730364173; h=message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=USKI+yc5zGWMk7NxZkh0uKVcNiH3sZS1pFmuOkouVZI=; b=d7bXW5DNf3od3zXT7d/asRdwlJZzlyCQNljPpyHxUe2HtNOu+Wb3BOgNqXMWkkarh4 mKc18CWL70DzEVA6yKkx/PdZ11qTnyggYptKbczHpG6V6KHpDTxpeXzWGrMFLTre4OZk Qkv08+cFyAiuyrSu/8t2siWRwoR8oygOPwN5GuLDzMXAqZvLg7SRA4RGvnVn1l41C8nQ QML8GASXyBecejlKWzA2llgwlFSNFSeDevHGdD94fShOM72iwNNqrE+kYFhH9qRddlHH 6NbjXjfGrfiH/X/ugCA5XLSmyR6fIEwkc2KtUawxBHLmmIOBQ1ih/Kh/Y9Z5JoJzNmO+ HM0g== X-Gm-Message-State: AOJu0YwE8Ce67QDpVfWRrFVN/dOcOiWnzixTXg/gqlC2ZFd6UH+B/yd9 WsPCzDQUpLW2w+jqmZ8HRGd3+F2tjVJI0934utEREvNvjZPUbb8x7pncPaJj X-Google-Smtp-Source: AGHT+IF0+/rOMmKeb+ZWgk1XBgRc/UZde0lLmpSJaFIZu5rs8NIB5ZPIORAWYckFxXVbnqOkgtdpwg== X-Received: by 2002:a05:6402:254b:b0:5ca:da2:b2ca with SMTP id 4fb4d7f45d1cf-5cb8acba591mr5221649a12.19.1729759372461; Thu, 24 Oct 2024 01:42:52 -0700 (PDT) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5cb66c6b556sm5369738a12.63.2024.10.24.01.42.51 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 24 Oct 2024 01:42:51 -0700 (PDT) From: Wei Yang To: akpm@linux-foundation.org, lorenzo.stoakes@oracle.com, vbabka@suse.cz, jannh@google.com Cc: linux-mm@kvack.org, Wei Yang Subject: [PATCH] mm/vma: the pgoff is correct if can_merge_right Date: Thu, 24 Oct 2024 08:42:22 +0000 Message-Id: <20241024084222.17201-1-richard.weiyang@gmail.com> X-Mailer: git-send-email 2.11.0 X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 9B8A814000D X-Stat-Signature: qi1ndeybqaw3ucmrstgb374bxzqicrh8 X-Rspam-User: X-HE-Tag: 1729759360-879260 X-HE-Meta: U2FsdGVkX1/ES5DNe3FlUsZqYx8uC3jlm4h9eM0PDlsAKPRbVC1Aep6aEo1eEsLdze3kYAcPwQKNvBDlVRAoexUGKBcIapcUk2KXFiGW+ENF1OrYhYBnSiGKBe4U1ZBeSbLwhvXXTGbQWIz4dyO9xhRmvZ4f48ydHwzknouLKNXrIx8vGD9SG7t0Ce33rI6hZtSgKczREbMw1ReU1cp4vxWI8+gEfIs+SdFci48p2JDnGNzMa9HB/RLPFuIUV3VI37f/2s5Tj1PYe93Tnp8MMNeFZDwKyloJ48nCMH/lDlIO0SB1W17j840YqiftFmMNRHeQPN7GapB/JvXwTCG4MaEiiTuUY/J4xeo4uZcToW/dD7dbNmVfL02uqYmYuJZb6d1GM2j7MKQT1rMxoUdTrywmN6gSNnq7xffmf5x3EdMT8LoTfqK6cZJdZACJwYVneAh0/JrKXzbfrjAG5gvjJFOGfAC5LJ0HxMd+i9NcKtsBjBGtCLR/DNy0Etg1Zd5AjmcqnuyoYRM1OSUJKbD9iutmLbTEtAN/My3u0DsBDPrHGEr5GEM8lpxbtxaIYGj06kQLJst3hQtEMIuNR3PmkvDVxeeLWqyMbHPOYeYq5O/ymNFz0PCNPwjouCNDV+Z2EF+tHW2IgIP9IHXAMJiFLd1mXE2NwHnCGKwsB07HbHJShwMMLOCocO4HRvUEJXolOsUyfHoipMgvTFNUoh7a7l/1iDXiQpLbujhVAkl43pIxJU+5TuMpkut7GYoW3GPS+peP0lxSNIeqR4hbPVaXcoNEUesE9oDLHgyIoYwiUAg1BD64zRzQY3Yt2DhxjXhTIezgAb/otRHodw3Lq+O6dYRdJNic3Vlka/0sK14K2R1rXhncDMGhX2q++c6D2BjOOw7lyAkwtXOWLjz7ES0MFiem4RQcKLcbJ4/P/xuopKp4m+4/w/2PJHiBp77dorXb6iUmwmFradQ0MI28ie8 1p9gw170 hY7JqaZeDjZ6Rq0sLQbSHA74WOoqvqgu52YgZKnovV2ZrunA8XUonkvRjLG2xXaY6Cl2W5S1k5US5EXucET+s1qzCy0MOgM3qyB/rNMp8bn4D9EfTxBbC9BlFCDOuNDEJbPgRxtqnGEOo3lnzc+8P5vYD0oKArDgRlwYyg7XBnEQQH+WpFsPg1quLihyeGimnzs7FtYoyf9WV6OTdhED9bgiIX8ospyAe1qxYzak9mwoyHpg/Ig3FZFs4TK/QuhdlKepm1DWgLGqx8P/bT66SaOPc9vFPVh+6/YlqZBWAdo82ATNlw3+JtZT63TRDQbq/H3i3jyNOJxq8ycKeHPOd2dSFxEPPK2VkcDdoZZTYMor3greo9rAoE6IwR5wiwW6Cbo5BXirv4IxYSxFd2DRNK6S6dxBWlZpbM3MSx/RcyrrPSci3lmmcz64CNyD04NQshXz2TDtn9I5ERv7+NYwHS8PLMkZ0ak26fyApmmygQ534uw6FqBBVMHGlaeFRcJech7Qp 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: List-Subscribe: List-Unsubscribe: can_merge_right implies can_vma_merge_right() has checked the pgoff. Don't need to assign it again. Signed-off-by: Wei Yang CC: Lorenzo Stoakes Reviewed-by: Lorenzo Stoakes --- mm/vma.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/mm/vma.c b/mm/vma.c index 4737afcb064c..fb4f1863f88e 100644 --- a/mm/vma.c +++ b/mm/vma.c @@ -915,7 +915,6 @@ struct vm_area_struct *vma_merge_new_range(struct vma_merge_struct *vmg) unsigned long start = vmg->start; unsigned long end = vmg->end; pgoff_t pgoff = vmg->pgoff; - pgoff_t pglen = PHYS_PFN(end - start); bool can_merge_left, can_merge_right; mmap_assert_write_locked(vmg->mm); @@ -936,7 +935,6 @@ struct vm_area_struct *vma_merge_new_range(struct vma_merge_struct *vmg) if (can_merge_right) { vmg->end = next->vm_end; vmg->vma = next; - vmg->pgoff = next->vm_pgoff - pglen; } /* If we can merge with the previous VMA, adjust vmg accordingly. */