From mboxrd@z Thu Jan 1 00:00:00 1970 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 0B086C61DA4 for ; Mon, 6 Mar 2023 01:02:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229609AbjCFBCE (ORCPT ); Sun, 5 Mar 2023 20:02:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38886 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229526AbjCFBCE (ORCPT ); Sun, 5 Mar 2023 20:02:04 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D4F62B765 for ; Sun, 5 Mar 2023 17:02:02 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 26554B80159 for ; Mon, 6 Mar 2023 01:02:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D61CEC433EF; Mon, 6 Mar 2023 01:01:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1678064519; bh=PHlhkKWez+CVbhRwrw2eEHQctwoLXDb4sPG1wmggK2Q=; h=Date:To:From:Subject:From; b=NqQ2n3m8lphXv8mvGi9IvmApC/FTOh/sseVS9Iy8uR0z6c0EU22V/N9RaudxwYCGE h9wbG6fslsm8xyHoG6jwF1BM4vt/P+tTF8dNad/3utAf8tyHv9RSMUlbdi/dsK5s72 1BdMkCqr9PBeq4TqDohUMvSOSOI3HDB7SKN9LlRc= Date: Sun, 05 Mar 2023 17:01:59 -0800 To: mm-commits@vger.kernel.org, ziy@nvidia.com, xhao@linux.alibaba.com, willy@infradead.org, torvalds@linux-foundation.org, shy828301@gmail.com, osalvador@suse.de, bharata@amd.com, baolin.wang@linux.alibaba.com, apopple@nvidia.com, ying.huang@intel.com, akpm@linux-foundation.org From: Andrew Morton Subject: [alternative-merged] migrate_pages-silence-gcc-notes-for-mis-casting.patch removed from -mm tree Message-Id: <20230306010159.D61CEC433EF@smtp.kernel.org> Precedence: bulk Reply-To: linux-kernel@vger.kernel.org List-ID: X-Mailing-List: mm-commits@vger.kernel.org The quilt patch titled Subject: migrate_pages: silence gcc notes for mis-casting has been removed from the -mm tree. Its filename was migrate_pages-silence-gcc-notes-for-mis-casting.patch This patch was dropped because an alternative patch was or shall be merged ------------------------------------------------------ From: Huang Ying Subject: migrate_pages: silence gcc notes for mis-casting Date: Thu, 2 Mar 2023 09:26:10 +0800 The following GCC notes was reported for commit 64c8902ed441 ("migrate_pages: split unmap_and_move() to _unmap() and _move()"). mm/migrate.c: In function `__migrate_folio_extract': mm/migrate.c:1050:20: note: randstruct: casting between randomized structure pointer types (ssa): `struct anon_vma' and `struct address_space' 1050 | *anon_vmap = (void *)dst->mapping; | ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ The casting itself is safe. Because we only use dst->mapping to store the pointer itself temporarily and dst is a newly allocated folio and not used by anyone else during that. But the notes should be silenced and some comments are deserved. So, we do that in this patch. Link: https://lkml.kernel.org/r/20230302012610.17055-1-ying.huang@intel.com Fixes: 64c8902ed441 ("migrate_pages: split unmap_and_move() to _unmap() and _move()") Signed-off-by: "Huang, Ying" Cc: Linus Torvalds Cc: Baolin Wang Cc: Xin Hao Cc: Zi Yan Cc: Yang Shi Cc: Oscar Salvador Cc: Matthew Wilcox Cc: Bharata B Rao Cc: Alistair Popple Signed-off-by: Andrew Morton --- --- a/mm/migrate.c~migrate_pages-silence-gcc-notes-for-mis-casting +++ a/mm/migrate.c @@ -1047,7 +1047,16 @@ static void __migrate_folio_extract(stru int *page_was_mappedp, struct anon_vma **anon_vmap) { - *anon_vmap = (void *)dst->mapping; + struct anon_vma *anon_vma; + + /* + * 2 steps assignment to silence gcc notes for mis-casting. The + * casting is safe. Because we only use dst->mapping to store + * the pointer itself temporarily and dst is a newly allocated + * folio and not used by anyone else during that. + */ + anon_vma = (void *)dst->mapping; + *anon_vmap = anon_vma; *page_was_mappedp = (unsigned long)dst->private; dst->mapping = NULL; dst->private = NULL; _ Patches currently in -mm which might be from ying.huang@intel.com are migrate_pages-fix-deadlock-in-batched-migration.patch migrate_pages-move-split-folios-processing-out-of-migrate_pages_batch.patch migrate_pages-try-migrate-in-batch-asynchronously-firstly.patch