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 E0397C678DB for ; Fri, 24 Feb 2023 03:02:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229870AbjBXDCz (ORCPT ); Thu, 23 Feb 2023 22:02:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42158 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229849AbjBXDCx (ORCPT ); Thu, 23 Feb 2023 22:02:53 -0500 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 27FC844AC; Thu, 23 Feb 2023 19:02:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1677207772; x=1708743772; h=from:to:cc:subject:references:date:in-reply-to: message-id:mime-version:content-transfer-encoding; bh=v+OHKdxrw/nM2qX9sYd6aRRdtAU9Je2UuBYcv5BP8wY=; b=ORXA0fGA0ddSDJv3UVLZt/DPKqvSToIcFcAHp1ATnBLMicjl+5JJ/xmG eIf6i/R5AMbNzz9P5/EihzxLf2uh3ArGJ39OD6atbBIlDKvQqdjE1iIDw Vk1s4nP8ykfoMVMGNpoT0IL2swM9wIMZqemueL5LEKIjMKlnNKAeUNvFC euBFwu+mZVjWm8HSvXOn6BA0aJrMmemqUEhRn+0mskmLTkrZLUHStD9B3 /Q3MHvZp1io2pUkgG5IrHiH+JGfOtpFFc/psgZ1woA5az3YXqZUXxPous h6rd1geuIfqtUQYZqWzBDAxFZjkzSrinxKsThzkTCg9bRgdKmKKMXOZlp w==; X-IronPort-AV: E=McAfee;i="6500,9779,10630"; a="331117111" X-IronPort-AV: E=Sophos;i="5.97,322,1669104000"; d="scan'208";a="331117111" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Feb 2023 19:02:51 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10630"; a="918274147" X-IronPort-AV: E=Sophos;i="5.97,322,1669104000"; d="scan'208";a="918274147" Received: from yhuang6-desk2.sh.intel.com (HELO yhuang6-desk2.ccr.corp.intel.com) ([10.238.208.55]) by fmsmga006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Feb 2023 19:02:45 -0800 From: "Huang, Ying" To: Linus Torvalds Cc: Andrew Morton , Jan Kara , Vishal Moola , Paulo Alcantara , Matthew Wilcox , David Howells , Steve French , Baolin Wang , Xin Hao , linux-mm@kvack.org, mm-commits@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [GIT PULL] MM updates for 6.3-rc1 References: <20230220135225.91b0f28344c01d5306c31230@linux-foundation.org> Date: Fri, 24 Feb 2023 11:01:49 +0800 In-Reply-To: (Linus Torvalds's message of "Thu, 23 Feb 2023 17:33:37 -0800") Message-ID: <87cz5zdaw2.fsf@yhuang6-desk2.ccr.corp.intel.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Linus Torvalds writes: > > - gcc 12.2.1 quite reasonable complains about some of the new MM code: > > mm/migrate.c: In function =E2=80=98__migrate_folio_extract=E2=80=99: > mm/migrate.c:1050:20: note: randstruct: casting between randomized > structure pointer types (ssa): =E2=80=98struct anon_vma=E2=80=99 and =E2= =80=98struct > address_space=E2=80=99 > > 1050 | *anon_vmap =3D (void *)dst->mapping; > | ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ > > and while this doesn't cause a build failure ("note" is different > from "warning"), I do think something needs to be done. Gcc is right. > This code seems to *work* simply because it's intentionally > mis-casting pointers, Yes. The mis-casting is intentional. I just need some place to hold the data temporarily (save in __migrate_folio_record() and clear in __migrate_folio_extract()). And "dst" is newly allocated folio. > but I think it needs to be seriously looked at and something done to > make gcc happy (and a *LARGE* comment about it). Sure. I will check whether there's some way to make gcc happy and add some comments about that. There's some comments for __migrate_folio_extract(), but that's isn't enough apprently.) > That last note is not some merge result, it's purely about the new MM cod= e. > [snip] Best Regards, Huang, Ying