From patchwork Mon Jun 6 14:15:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Fabio M. De Francesco" X-Patchwork-Id: 12870414 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 E0DDEC43334 for ; Mon, 6 Jun 2022 14:15:45 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 279796B0071; Mon, 6 Jun 2022 10:15:45 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1FC956B0073; Mon, 6 Jun 2022 10:15:45 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0739D6B0074; Mon, 6 Jun 2022 10:15:45 -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 E95DA6B0071 for ; Mon, 6 Jun 2022 10:15:44 -0400 (EDT) Received: from smtpin31.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay12.hostedemail.com (Postfix) with ESMTP id C4514120754 for ; Mon, 6 Jun 2022 14:15:44 +0000 (UTC) X-FDA: 79548009408.31.C01C57A Received: from mail-ed1-f46.google.com (mail-ed1-f46.google.com [209.85.208.46]) by imf08.hostedemail.com (Postfix) with ESMTP id CBD62160048 for ; Mon, 6 Jun 2022 14:15:15 +0000 (UTC) Received: by mail-ed1-f46.google.com with SMTP id v25so19029914eda.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=TqDLPlQWyJLxTvEDSD2zBJjz2NXwK1dlueZsh7rYfsSYnk4VYYtYsfHfhPpJ29+F/H rHoVegqLcWb7Xa3j3gbJoI7N0pFlUynXLsPxlYwvCGN/TVJ4uA/PoWQ6MKooDzVQsUpG ul6y9f/EOqZnngC8Qvucn/h8guyGQjxe973SLki/686iO87npjm1IQUd06yydXnwuwfZ oCFJV7i5XanbHZs8VI/a5CxYOcorz098dhyXSNfng0enfvHWNGIElbwi28dbPj1u8rlG Q6w21c1ILGZE1GMdU2g9DXgy2/irPS27e6PVY4MCiJxuGrqCh4idN7JtoAMvgBZBmquy 6KbA== X-Gm-Message-State: AOAM530oTk8QuEItogn6SSkZMKXqMM4R0madYFVBRSB4oYJWSbjQwf9R SVLHvsHGcq8TYNhUF5+YZ5o= 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 X-Stat-Signature: 8a8xbfs1zgxprqj989dpsmei7qoa4zmi X-Rspam-User: Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=ZZfEZRiL; spf=pass (imf08.hostedemail.com: domain of fmdefrancesco@gmail.com designates 209.85.208.46 as permitted sender) smtp.mailfrom=fmdefrancesco@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: CBD62160048 X-HE-Tag: 1654524915-341060 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: 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 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); } -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) {