From nobody Tue Apr 28 05:05:43 2026 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EA434CCA484 for ; Mon, 6 Jun 2022 14:16:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239507AbiFFOQy (ORCPT ); Mon, 6 Jun 2022 10:16:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56300 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239516AbiFFOPu (ORCPT ); Mon, 6 Jun 2022 10:15:50 -0400 Received: from mail-ed1-x52f.google.com (mail-ed1-x52f.google.com [IPv6:2a00:1450:4864:20::52f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 53E282D1F6 for ; Mon, 6 Jun 2022 07:15:44 -0700 (PDT) Received: by mail-ed1-x52f.google.com with SMTP id v25so19029907eda.6 for ; Mon, 06 Jun 2022 07:15:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=6rWhlveeN1TxX4QHQ5iFPAm0c2ZnKQvWl2EyCos39TM=; b=ZZfEZRiLhkBMeDoURpm3uOeoX3BbxCOg5m6ukqdT3N+bgCa4cZY0UYuPiz01bJni7w S1I42czSmWZjgAA1z/SkChFOB6tDovtRLJNjtkkzrh5nc6nHkiznCGu0UW9TaQMBcIuk 6EXpAnWy8RQiXzcN+99s5NHDgVVnhAabieMYeM1CZErYqV50/sUKaRK1MgvYgkH7G80F rD9tONFaF0ii9fiSsHQDUrujVUAEJ+iXbIGKazHiDF4i7YHQJ78rZ6DXnn2FQRKK9RvB CuA3ImFDY7FgaXH8s5Rbcs/lVqNxFB1Q9QDyXkHbFXC4dc5H0fdfJ4fL2ixyeQaakbCI 32Cg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=6rWhlveeN1TxX4QHQ5iFPAm0c2ZnKQvWl2EyCos39TM=; b=69PKp9oRoExuHlk2JooWFh615ghg/UwVKTXVqwv/58vcdHnIVpKmc2aRdpZfd7+6MR oycpsNV5u4I8S9svd7jKglFs+eYeTW1iQplxLWkTBb0g1bz1HC6cEMPTIFbYjDZUUW6U gUlgGmWgvsGnR+jyClxEw3phkV1Pu+6mIbGDjJ4H3d3FXgk8wA2kVakqnljGLjsvHD6I uWoGCduXHurCkCoCOj6UrUzwwoATIBvsmHtmRmHo/n8wpb0Kn5Q4Z9WGRpSQSm9Z6n6h c6q8qYN98QAvCusVfi4m1VbWQsLZME9d55mfJ9IIaaPecF16I9E3mJxyI5exM1wnYhcg WNSw== X-Gm-Message-State: AOAM531II5Iw3kjFPtru+3SKTzqvLeFyHJId6QF9MkcYyMb+TM2qxhpP FOiGjfvcTS9i2OF8GuxOtaQ= X-Google-Smtp-Source: ABdhPJwvLpggZGcluym7wsFNn4RHXYfzHTkwCPuZ2jBlXQZYtAudkyn7Br+hRBOtcpK/6Voy+abcZg== X-Received: by 2002:a05:6402:430f:b0:42e:2a86:abaf with SMTP id m15-20020a056402430f00b0042e2a86abafmr20795604edc.194.1654524942790; Mon, 06 Jun 2022 07:15:42 -0700 (PDT) Received: from localhost.localdomain (host-79-13-108-3.retail.telecomitalia.it. [79.13.108.3]) by smtp.gmail.com with ESMTPSA id y21-20020a056402135500b0042aa5a74598sm9069837edw.52.2022.06.06.07.15.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jun 2022 07:15:41 -0700 (PDT) From: "Fabio M. De Francesco" To: Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Sebastian Andrzej Siewior Cc: "Fabio M. De Francesco" , Matthew Wilcox , Ira Weiny Subject: [PATCH] mm/highmem: Delete memmove_page() Date: Mon, 6 Jun 2022 16:15:33 +0200 Message-Id: <20220606141533.555-1-fmdefrancesco@gmail.com> X-Mailer: git-send-email 2.36.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Matthew Wilcox reported that, while he was looking at memmove_page(), he realized that it can't actually work. The reasons are hidden in its implementation, which makes use of memmove() on logical addresses provided by kmap_local_page(). memmove() does the wrong thing when it tests "if (dest <=3D src)". Therefore, delete memmove_page(). No need to change any other code because we have no call sites of memmove_page() across the whole kernel. Reported-by: Matthew Wilcox Cc: Ira Weiny Signed-off-by: Fabio M. De Francesco Reviewed-by: Baoquan He Reviewed-by: Ira Weiny --- include/linux/highmem.h | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/include/linux/highmem.h b/include/linux/highmem.h index 3af34de54330..fee9835e3793 100644 --- a/include/linux/highmem.h +++ b/include/linux/highmem.h @@ -336,19 +336,6 @@ static inline void memcpy_page(struct page *dst_page, = size_t dst_off, kunmap_local(dst); } =20 -static inline void memmove_page(struct page *dst_page, size_t dst_off, - struct page *src_page, size_t src_off, - size_t len) -{ - char *dst =3D kmap_local_page(dst_page); - char *src =3D kmap_local_page(src_page); - - VM_BUG_ON(dst_off + len > PAGE_SIZE || src_off + len > PAGE_SIZE); - memmove(dst + dst_off, src + src_off, len); - kunmap_local(src); - kunmap_local(dst); -} - static inline void memset_page(struct page *page, size_t offset, int val, size_t len) { --=20 2.36.1