Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp501590iof; Mon, 6 Jun 2022 07:31:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyuO5TPKe7iZN4BJ4kxjbewytX6pWOUEBq5hGSMYypvpfaRwKO3MlQO5pXfvzM7pFCWe6Jn X-Received: by 2002:a17:90b:17c6:b0:1e8:2c09:d006 with SMTP id me6-20020a17090b17c600b001e82c09d006mr20029167pjb.31.1654525860501; Mon, 06 Jun 2022 07:31:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654525860; cv=none; d=google.com; s=arc-20160816; b=vxpuh4mlXKWyj5W2b1mioLnfVbiht8n7h91fDNDBe0UY9moUHuGgwxFGotQI7Vlv7R Qj4l4g5rVj9uqELVqtsH/LJxhEz+Ru3/oriHQfkEkNA7PNTOZfwb1DY5rrBMUQMuAJ/e 9qt3G/zus68k+WY+E72pgcZXVr0Vfft2f2YVkqIHJ6DrMuo5Jh47pU5aAci9s6zMQ4hv 0zNY3kTLQEW30CYu6PhkiuRmf7figxkI9zkVxSTUVuBOO5vbl/KS5YFHby5ls0HszrDt CqL9OCCrobXp/CVzbXzWvidlnjpfEZsxiSMrFv7JvKfMzGkUpKd/4r5wLhQSjagsZScH QQ+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=6rWhlveeN1TxX4QHQ5iFPAm0c2ZnKQvWl2EyCos39TM=; b=xR/fAnVS3v1pYOxKgNkC3+FeWT08acydnOGAS1CUZOU4xSYMC/beySL97YyYVNPVbw 3kDkv1d7v2zhixiB+I15Ty8zf/tDeVevbUBMDNT214ZTr/Nenr0B1Jo7ZRtXficxAUEX qgXiU+hUgkxHU9fR6AZC9OXu3NTT5yCTBBDr0VZsCZmQ9+l605KHsDuDvHbdW+Bida2d tqrBKrzm82B6pq28Gu5MRX4ZUKszZDG2CT0MZqolzHmQQ/sVkjgz557iQRQsfpVyeUpv TFGdWxORJhiPv5zVy+DbwCMol43+UT3EkAAc2iHUsaLHAz775Ib9b40Anfuwf+fITY8C mFnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=ZZfEZRiL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id f1-20020a63dc41000000b003fc8c4e29bdsi19550872pgj.300.2022.06.06.07.30.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jun 2022 07:31:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=ZZfEZRiL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 4402A2CE33; Mon, 6 Jun 2022 07:18:15 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239503AbiFFOQx (ORCPT + 99 others); Mon, 6 Jun 2022 10:16:53 -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-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: 8bit X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 <= 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 --- 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); } -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 = kmap_local_page(dst_page); - char *src = 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) { -- 2.36.1