From patchwork Fri Sep 24 22:43:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 12516953 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 81124C4332F for ; Fri, 24 Sep 2021 22:43:23 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 05716610C7 for ; Fri, 24 Sep 2021 22:43:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 05716610C7 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 998F96B0072; Fri, 24 Sep 2021 18:43:22 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 947D56B0073; Fri, 24 Sep 2021 18:43:22 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8378C6B0074; Fri, 24 Sep 2021 18:43:22 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0127.hostedemail.com [216.40.44.127]) by kanga.kvack.org (Postfix) with ESMTP id 762D46B0072 for ; Fri, 24 Sep 2021 18:43:22 -0400 (EDT) Received: from smtpin17.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 393CC3A7AE for ; Fri, 24 Sep 2021 22:43:22 +0000 (UTC) X-FDA: 78623944644.17.B2ACED7 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf04.hostedemail.com (Postfix) with ESMTP id E581050000B0 for ; Fri, 24 Sep 2021 22:43:21 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id B8B1261019; Fri, 24 Sep 2021 22:43:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1632523401; bh=EvuUAlpzSYOcprBe/h8oX+QM5LFSXdkN/iEH877IZLQ=; h=Date:From:To:Subject:In-Reply-To:From; b=rQqDKBvc5cnaFSo5KzxDmskaGl6iBMXsjxz7PrSBZxRtfX8ojTjaz2i5Qu+pvQf29 ntYHj3dx17OcGwhgiux9nvRzgAtTFQTunvZgG7YlLvY4rebWC2wC5BjM6ZDnGELOup VM3a/A4vS/C5HPuKPq7XiKiqTvugICZVGBN3JEU0= Date: Fri, 24 Sep 2021 15:43:20 -0700 From: Andrew Morton To: akpm@linux-foundation.org, david@redhat.com, linux-mm@kvack.org, mhocko@suse.com, mike.kravetz@oracle.com, mm-commits@vger.kernel.org, naoya.horiguchi@nec.com, osalvador@suse.de, shy828301@gmail.com, stable@vger.kernel.org, tony.luck@intel.com, torvalds@linux-foundation.org Subject: [patch 01/16] mm, hwpoison: add is_free_buddy_page() in HWPoisonHandlable() Message-ID: <20210924224320.S3vgzdWHO%akpm@linux-foundation.org> In-Reply-To: <20210924154257.1dbf6699ab8d88c0460f924f@linux-foundation.org> User-Agent: s-nail v14.8.16 X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: E581050000B0 X-Stat-Signature: xkgse81sz1iq737b4g3zrcwjht3si1tt Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=rQqDKBvc; dmarc=none; spf=pass (imf04.hostedemail.com: domain of akpm@linux-foundation.org designates 198.145.29.99 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org X-HE-Tag: 1632523401-632974 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: From: Naoya Horiguchi Subject: mm, hwpoison: add is_free_buddy_page() in HWPoisonHandlable() commit fcc00621d88b ("mm/hwpoison: retry with shake_page() for unhandlable pages") changes the return value of __get_hwpoison_page() to retry for transiently unhandlable cases. However, __get_hwpoison_page() currently fails to properly judge buddy pages as handlable, so hard/soft offline for buddy pages always fail as "unhandlable page". This is totally regrettable. So let's add is_free_buddy_page() in HWPoisonHandlable(), so that __get_hwpoison_page() returns different return values between buddy pages and unhandlable pages as intended. Link: https://lkml.kernel.org/r/20210909004131.163221-1-naoya.horiguchi@linux.dev Fixes: fcc00621d88b ("mm/hwpoison: retry with shake_page() for unhandlable pages") Signed-off-by: Naoya Horiguchi Acked-by: David Hildenbrand Reviewed-by: Yang Shi Cc: Tony Luck Cc: Oscar Salvador Cc: Mike Kravetz Cc: Michal Hocko Cc: Signed-off-by: Andrew Morton --- mm/memory-failure.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/mm/memory-failure.c~mm-hwpoison-add-is_free_buddy_page-in-hwpoisonhandlable +++ a/mm/memory-failure.c @@ -1126,7 +1126,7 @@ static int page_action(struct page_state */ static inline bool HWPoisonHandlable(struct page *page) { - return PageLRU(page) || __PageMovable(page); + return PageLRU(page) || __PageMovable(page) || is_free_buddy_page(page); } static int __get_hwpoison_page(struct page *page) From patchwork Fri Sep 24 22:43:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 12516955 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 657FDC433FE for ; Fri, 24 Sep 2021 22:43:26 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 0909161250 for ; Fri, 24 Sep 2021 22:43:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 0909161250 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id A348C6B0073; Fri, 24 Sep 2021 18:43:25 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9E4636B0074; Fri, 24 Sep 2021 18:43:25 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 85EB76B0075; Fri, 24 Sep 2021 18:43:25 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0209.hostedemail.com [216.40.44.209]) by kanga.kvack.org (Postfix) with ESMTP id 782306B0073 for ; Fri, 24 Sep 2021 18:43:25 -0400 (EDT) Received: from smtpin08.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 393C23A2D7 for ; Fri, 24 Sep 2021 22:43:25 +0000 (UTC) X-FDA: 78623944770.08.D9A4439 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf10.hostedemail.com (Postfix) with ESMTP id E86CA6001983 for ; Fri, 24 Sep 2021 22:43:24 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id D525E610C7; Fri, 24 Sep 2021 22:43:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1632523404; bh=nScy0Wx1xgJfJ0hGOIXW7AMGpzIu1SOmolvT6N7GLtY=; h=Date:From:To:Subject:In-Reply-To:From; b=y/7E93H6/liobOGfgmFh5EhDlY61hgDSpYnP9VGeHQZBDmf4s1kkWcdoB/9BKdDZT py7tD1ZaDBTOc+jxuVBUaMGZkpScOxG8Dm4m2nTplwdUnUTfQ+GglAHHuIDhAkkRUS lZt+rGPL3PtISiAZR0z5oCMhCv04R+9wshZ+D0QU= Date: Fri, 24 Sep 2021 15:43:23 -0700 From: Andrew Morton To: akpm@linux-foundation.org, andreyknvl@gmail.com, dvyukov@google.com, elver@google.com, glider@google.com, linux-mm@kvack.org, mm-commits@vger.kernel.org, nogikh@google.com, ryabinin.a.a@gmail.com, tarasmadan@google.com, torvalds@linux-foundation.org Subject: [patch 02/16] kasan: fix Kconfig check of CC_HAS_WORKING_NOSANITIZE_ADDRESS Message-ID: <20210924224323.hVb3058Us%akpm@linux-foundation.org> In-Reply-To: <20210924154257.1dbf6699ab8d88c0460f924f@linux-foundation.org> User-Agent: s-nail v14.8.16 X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: E86CA6001983 X-Stat-Signature: 1ga93tnsowjcgbz3r1sxfebsdshp6u93 Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b="y/7E93H6"; dmarc=none; spf=pass (imf10.hostedemail.com: domain of akpm@linux-foundation.org designates 198.145.29.99 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org X-HE-Tag: 1632523404-626642 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: From: Marco Elver Subject: kasan: fix Kconfig check of CC_HAS_WORKING_NOSANITIZE_ADDRESS In the main KASAN config option CC_HAS_WORKING_NOSANITIZE_ADDRESS is checked for instrumentation-based modes. However, if HAVE_ARCH_KASAN_HW_TAGS is true all modes may still be selected. To fix, also make the software modes depend on CC_HAS_WORKING_NOSANITIZE_ADDRESS. Link: https://lkml.kernel.org/r/20210910084240.1215803-1-elver@google.com Fixes: 6a63a63ff1ac ("kasan: introduce CONFIG_KASAN_HW_TAGS") Signed-off-by: Marco Elver Cc: Andrey Ryabinin Cc: Alexander Potapenko Cc: Andrey Konovalov Cc: Dmitry Vyukov Cc: Aleksandr Nogikh Cc: Taras Madan Signed-off-by: Andrew Morton --- lib/Kconfig.kasan | 2 ++ 1 file changed, 2 insertions(+) --- a/lib/Kconfig.kasan~kasan-fix-kconfig-check-of-cc_has_working_nosanitize_address +++ a/lib/Kconfig.kasan @@ -66,6 +66,7 @@ choice config KASAN_GENERIC bool "Generic mode" depends on HAVE_ARCH_KASAN && CC_HAS_KASAN_GENERIC + depends on CC_HAS_WORKING_NOSANITIZE_ADDRESS select SLUB_DEBUG if SLUB select CONSTRUCTORS help @@ -86,6 +87,7 @@ config KASAN_GENERIC config KASAN_SW_TAGS bool "Software tag-based mode" depends on HAVE_ARCH_KASAN_SW_TAGS && CC_HAS_KASAN_SW_TAGS + depends on CC_HAS_WORKING_NOSANITIZE_ADDRESS select SLUB_DEBUG if SLUB select CONSTRUCTORS help From patchwork Fri Sep 24 22:43:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 12516957 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3D970C433F5 for ; Fri, 24 Sep 2021 22:43:29 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id DD76161250 for ; Fri, 24 Sep 2021 22:43:28 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org DD76161250 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 7EBC96B0074; Fri, 24 Sep 2021 18:43:28 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 776716B0075; Fri, 24 Sep 2021 18:43:28 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 689A7900002; Fri, 24 Sep 2021 18:43:28 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0084.hostedemail.com [216.40.44.84]) by kanga.kvack.org (Postfix) with ESMTP id 599776B0074 for ; Fri, 24 Sep 2021 18:43:28 -0400 (EDT) Received: from smtpin13.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 139433A2D7 for ; Fri, 24 Sep 2021 22:43:28 +0000 (UTC) X-FDA: 78623944896.13.BD04A25 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf10.hostedemail.com (Postfix) with ESMTP id C50EA600198B for ; Fri, 24 Sep 2021 22:43:27 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id CEC44610F7; Fri, 24 Sep 2021 22:43:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1632523407; bh=uWwxeLdlOGjaTzqH97Y4wiX9ndCY9tuHs3E3OZZlPkg=; h=Date:From:To:Subject:In-Reply-To:From; b=iHNHVFG5aL3D8oguHZ8B1fUBb79iBGsZr3+BjfiMYx9nGNMANynZeUFjU27jQzwD7 dxInDa3XNdpuzczMnUCcujhOHbuzWHBYU2gxhVGJ3t8yUd6zAmMsQQdeDZnutRX6zF rywYJKdF+wDy+gRe8BTmZTnVZI+ojb9ttQIpuGb8= Date: Fri, 24 Sep 2021 15:43:26 -0700 From: Andrew Morton To: akpm@linux-foundation.org, kilobyte@angband.pl, linux-mm@kvack.org, mm-commits@vger.kernel.org, sj38.park@gmail.com, torvalds@linux-foundation.org Subject: [patch 03/16] mm/damon: don't use strnlen() with known-bogus source length Message-ID: <20210924224326.LWI0zk_0G%akpm@linux-foundation.org> In-Reply-To: <20210924154257.1dbf6699ab8d88c0460f924f@linux-foundation.org> User-Agent: s-nail v14.8.16 X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: C50EA600198B X-Stat-Signature: ta4adiqbtqwxjmkm3ubxf6ijawimxpyk Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=iHNHVFG5; spf=pass (imf10.hostedemail.com: domain of akpm@linux-foundation.org designates 198.145.29.99 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org; dmarc=none X-HE-Tag: 1632523407-744354 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: From: Adam Borowski Subject: mm/damon: don't use strnlen() with known-bogus source length gcc knows the true length too, and rightfully complains. Link: https://lkml.kernel.org/r/20210912204447.10427-1-kilobyte@angband.pl Signed-off-by: Adam Borowski Cc: SeongJae Park Signed-off-by: Andrew Morton --- mm/damon/dbgfs-test.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) --- a/mm/damon/dbgfs-test.h~mm-damon-dont-use-strnlen-with-known-bogus-source-length +++ a/mm/damon/dbgfs-test.h @@ -20,27 +20,27 @@ static void damon_dbgfs_test_str_to_targ ssize_t nr_integers = 0, i; question = "123"; - answers = str_to_target_ids(question, strnlen(question, 128), + answers = str_to_target_ids(question, strlen(question), &nr_integers); KUNIT_EXPECT_EQ(test, (ssize_t)1, nr_integers); KUNIT_EXPECT_EQ(test, 123ul, answers[0]); kfree(answers); question = "123abc"; - answers = str_to_target_ids(question, strnlen(question, 128), + answers = str_to_target_ids(question, strlen(question), &nr_integers); KUNIT_EXPECT_EQ(test, (ssize_t)1, nr_integers); KUNIT_EXPECT_EQ(test, 123ul, answers[0]); kfree(answers); question = "a123"; - answers = str_to_target_ids(question, strnlen(question, 128), + answers = str_to_target_ids(question, strlen(question), &nr_integers); KUNIT_EXPECT_EQ(test, (ssize_t)0, nr_integers); kfree(answers); question = "12 35"; - answers = str_to_target_ids(question, strnlen(question, 128), + answers = str_to_target_ids(question, strlen(question), &nr_integers); KUNIT_EXPECT_EQ(test, (ssize_t)2, nr_integers); for (i = 0; i < nr_integers; i++) @@ -48,7 +48,7 @@ static void damon_dbgfs_test_str_to_targ kfree(answers); question = "12 35 46"; - answers = str_to_target_ids(question, strnlen(question, 128), + answers = str_to_target_ids(question, strlen(question), &nr_integers); KUNIT_EXPECT_EQ(test, (ssize_t)3, nr_integers); for (i = 0; i < nr_integers; i++) @@ -56,7 +56,7 @@ static void damon_dbgfs_test_str_to_targ kfree(answers); question = "12 35 abc 46"; - answers = str_to_target_ids(question, strnlen(question, 128), + answers = str_to_target_ids(question, strlen(question), &nr_integers); KUNIT_EXPECT_EQ(test, (ssize_t)2, nr_integers); for (i = 0; i < 2; i++) @@ -64,13 +64,13 @@ static void damon_dbgfs_test_str_to_targ kfree(answers); question = ""; - answers = str_to_target_ids(question, strnlen(question, 128), + answers = str_to_target_ids(question, strlen(question), &nr_integers); KUNIT_EXPECT_EQ(test, (ssize_t)0, nr_integers); kfree(answers); question = "\n"; - answers = str_to_target_ids(question, strnlen(question, 128), + answers = str_to_target_ids(question, strlen(question), &nr_integers); KUNIT_EXPECT_EQ(test, (ssize_t)0, nr_integers); kfree(answers); From patchwork Fri Sep 24 22:43:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 12516959 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 633A5C433EF for ; Fri, 24 Sep 2021 22:43:32 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id D1AE761019 for ; Fri, 24 Sep 2021 22:43:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org D1AE761019 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 74F5A6B0075; Fri, 24 Sep 2021 18:43:31 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6FF34900002; Fri, 24 Sep 2021 18:43:31 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5C66A6B007B; Fri, 24 Sep 2021 18:43:31 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0114.hostedemail.com [216.40.44.114]) by kanga.kvack.org (Postfix) with ESMTP id 4C54B6B0075 for ; Fri, 24 Sep 2021 18:43:31 -0400 (EDT) Received: from smtpin02.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 022A7180DC77C for ; Fri, 24 Sep 2021 22:43:31 +0000 (UTC) X-FDA: 78623945022.02.F3F3BA4 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf15.hostedemail.com (Postfix) with ESMTP id A6B67D000099 for ; Fri, 24 Sep 2021 22:43:30 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id B268161250; Fri, 24 Sep 2021 22:43:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1632523410; bh=kjyDcCJefQj11doQfipUBefsNYggdbHuXCRn2Gx79C8=; h=Date:From:To:Subject:In-Reply-To:From; b=eHJbAdrpADGajtIQk1hD0eiFvfe2qoCqR9RWBLChEQHMV0wbglHqjT68+s1PIifnD +0Rf8A3Q9CkRsudsGBvSF2XOK+OdT04OSpeASQjzNdDZZ8frHOcDaxpYXCqUnXsUpq +5eV1edaFC/IpUaRkIxKs+e4oUy8a6ESDSBx9SZg= Date: Fri, 24 Sep 2021 15:43:29 -0700 From: Andrew Morton To: akpm@linux-foundation.org, chris@zankel.net, David.Laight@ACULAB.COM, jcmvbkbc@gmail.com, linux-mm@kvack.org, linux@roeck-us.net, masahiroy@kernel.org, mm-commits@vger.kernel.org, torvalds@linux-foundation.org Subject: [patch 04/16] xtensa: increase size of gcc stack frame check Message-ID: <20210924224329.W5ZWD-MoS%akpm@linux-foundation.org> In-Reply-To: <20210924154257.1dbf6699ab8d88c0460f924f@linux-foundation.org> User-Agent: s-nail v14.8.16 X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: A6B67D000099 X-Stat-Signature: qrje65j15s7g8bnrcx4pm9hkzcyu94hy Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=eHJbAdrp; spf=pass (imf15.hostedemail.com: domain of akpm@linux-foundation.org designates 198.145.29.99 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org; dmarc=none X-HE-Tag: 1632523410-175578 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: From: Guenter Roeck Subject: xtensa: increase size of gcc stack frame check xtensa frame size is larger than the frame size for almost all other architectures. This results in more than 50 "the frame size of is larger than 1024 bytes" errors when trying to build xtensa:allmodconfig. Increase frame size for xtensa to 1536 bytes to avoid compile errors due to frame size limits. Link: https://lkml.kernel.org/r/20210912025235.3514761-1-linux@roeck-us.net Signed-off-by: Guenter Roeck Reviewed-by: Max Filippov Cc: Chris Zankel Cc: David Laight Cc: Masahiro Yamada Signed-off-by: Andrew Morton --- lib/Kconfig.debug | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/lib/Kconfig.debug~xtensa-increase-size-of-gcc-stack-frame-check +++ a/lib/Kconfig.debug @@ -346,7 +346,7 @@ config FRAME_WARN int "Warn for stack frames larger than" range 0 8192 default 2048 if GCC_PLUGIN_LATENT_ENTROPY - default 1536 if (!64BIT && PARISC) + default 1536 if (!64BIT && (PARISC || XTENSA)) default 1024 if (!64BIT && !PARISC) default 2048 if 64BIT help From patchwork Fri Sep 24 22:43:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 12516961 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4D6A5C433F5 for ; Fri, 24 Sep 2021 22:43:35 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id D55AC610C7 for ; Fri, 24 Sep 2021 22:43:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org D55AC610C7 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 79D376B0078; Fri, 24 Sep 2021 18:43:34 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 74C8A6B007B; Fri, 24 Sep 2021 18:43:34 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 63B076B007D; Fri, 24 Sep 2021 18:43:34 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 53EF36B0078 for ; Fri, 24 Sep 2021 18:43:34 -0400 (EDT) Received: from smtpin05.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id F331E180374DC for ; Fri, 24 Sep 2021 22:43:33 +0000 (UTC) X-FDA: 78623945106.05.6AA12F2 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf18.hostedemail.com (Postfix) with ESMTP id B96584002085 for ; Fri, 24 Sep 2021 22:43:33 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id AF0CC61019; Fri, 24 Sep 2021 22:43:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1632523412; bh=E114ElZcTSr+5tsI5+ea0qeRXF7axUHZkgjp/Ds95ac=; h=Date:From:To:Subject:In-Reply-To:From; b=kP8Dhy7t1QyS6l9UW27bXAnPTiAgdkQxJ0+QDqHd+E823LJpfEa7CjhUDAoihZSSU jQd2uOOJL00p2SxNW0mceGXpCzVrbGXeSuOUzoxKLjTsj41k2ssqUCxAi9V2QMcmX5 vNHj3YYkdeXTPqFLTsMCHcVz56tuiSWHvz5w0d2A= Date: Fri, 24 Sep 2021 15:43:32 -0700 From: Andrew Morton To: akpm@linux-foundation.org, hughd@google.com, kirill.shutemov@linux.intel.com, linux-mm@kvack.org, liuyuntao10@huawei.com, mm-commits@vger.kernel.org, torvalds@linux-foundation.org, wuxu.wu@huawei.com Subject: [patch 05/16] mm/shmem.c: fix judgment error in shmem_is_huge() Message-ID: <20210924224332.489iilWzd%akpm@linux-foundation.org> In-Reply-To: <20210924154257.1dbf6699ab8d88c0460f924f@linux-foundation.org> User-Agent: s-nail v14.8.16 X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: B96584002085 X-Stat-Signature: 69heymbaghp59ttkfkqykwkay7u8wcej Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=kP8Dhy7t; dmarc=none; spf=pass (imf18.hostedemail.com: domain of akpm@linux-foundation.org designates 198.145.29.99 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org X-HE-Tag: 1632523413-982396 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: From: Liu Yuntao Subject: mm/shmem.c: fix judgment error in shmem_is_huge() In the case of SHMEM_HUGE_WITHIN_SIZE, the page index is not rounded up correctly. When the page index points to the first page in a huge page, round_up() cannot bring it to the end of the huge page, but to the end of the previous one. An example: HPAGE_PMD_NR on my machine is 512(2 MB huge page size). After allcoating a 3000 KB buffer, I access it at location 2050 KB. In shmem_is_huge(), the corresponding index happens to be 512. After rounded up by HPAGE_PMD_NR, it will still be 512 which is smaller than i_size, and shmem_is_huge() will return true. As a result, my buffer takes an additional huge page, and that shouldn't happen when shmem_enabled is set to within_size. Link: https://lkml.kernel.org/r/20210909032007.18353-1-liuyuntao10@huawei.com Fixes: f3f0e1d2150b2b ("khugepaged: add support of collapse for tmpfs/shmem pages") Signed-off-by: Liu Yuntao Acked-by: Kirill A. Shutemov Acked-by: Hugh Dickins Cc: wuxu.wu Signed-off-by: Andrew Morton --- mm/shmem.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/mm/shmem.c~fix-judgment-error-in-shmem_is_huge +++ a/mm/shmem.c @@ -490,9 +490,9 @@ bool shmem_is_huge(struct vm_area_struct case SHMEM_HUGE_ALWAYS: return true; case SHMEM_HUGE_WITHIN_SIZE: - index = round_up(index, HPAGE_PMD_NR); + index = round_up(index + 1, HPAGE_PMD_NR); i_size = round_up(i_size_read(inode), PAGE_SIZE); - if (i_size >= HPAGE_PMD_SIZE && (i_size >> PAGE_SHIFT) >= index) + if (i_size >> PAGE_SHIFT >= index) return true; fallthrough; case SHMEM_HUGE_ADVISE: From patchwork Fri Sep 24 22:43:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 12516963 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5900BC433F5 for ; Fri, 24 Sep 2021 22:43:38 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 0835E61261 for ; Fri, 24 Sep 2021 22:43:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 0835E61261 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 9BFCE6B007B; Fri, 24 Sep 2021 18:43:37 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 96F5C6B007D; Fri, 24 Sep 2021 18:43:37 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 837D06B007E; Fri, 24 Sep 2021 18:43:37 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0072.hostedemail.com [216.40.44.72]) by kanga.kvack.org (Postfix) with ESMTP id 71B096B007B for ; Fri, 24 Sep 2021 18:43:37 -0400 (EDT) Received: from smtpin08.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 29DDE18036FF1 for ; Fri, 24 Sep 2021 22:43:37 +0000 (UTC) X-FDA: 78623945274.08.1C02363 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf25.hostedemail.com (Postfix) with ESMTP id D6299B000183 for ; Fri, 24 Sep 2021 22:43:36 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id B4E85610C7; Fri, 24 Sep 2021 22:43:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1632523416; bh=rA37PYHONDIG3MvsoHAzveB2Egr+eik4Izw0/KSpGnE=; h=Date:From:To:Subject:In-Reply-To:From; b=AkZeVTDSqx95emlo020iXkENsJudK1Ke/nbogy/fmcyrtgUHV7GVrx7i2BKWnyHD/ +h7lr/VHy3zEdtcc4+K1l/8GkkGf22jOVySWJVZtwOy110KBvdLEZ1n8TPf4vq/ahk BUTbK6005fWp2+fLwpsqBaSSpZ8nyiBqByzQS3VU= Date: Fri, 24 Sep 2021 15:43:35 -0700 From: Andrew Morton To: akpm@linux-foundation.org, gechangwei@live.cn, ghe@suse.com, jlbec@evilplan.org, joseph.qi@linux.alibaba.com, junxiao.bi@oracle.com, linux-mm@kvack.org, mark@fasheh.com, mm-commits@vger.kernel.org, piaojun@huawei.com, stable@vger.kernel.org, torvalds@linux-foundation.org, wen.gang.wang@oracle.com Subject: [patch 06/16] ocfs2: drop acl cache for directories too Message-ID: <20210924224335.qEoBbK0p3%akpm@linux-foundation.org> In-Reply-To: <20210924154257.1dbf6699ab8d88c0460f924f@linux-foundation.org> User-Agent: s-nail v14.8.16 X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: D6299B000183 X-Stat-Signature: y7h7yjrfibxufx4qeqwmqtd9s444i5hm Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=AkZeVTDS; dmarc=none; spf=pass (imf25.hostedemail.com: domain of akpm@linux-foundation.org designates 198.145.29.99 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org X-HE-Tag: 1632523416-32209 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: From: Wengang Wang Subject: ocfs2: drop acl cache for directories too ocfs2_data_convert_worker() is currently dropping any cached acl info for FILE before down-converting meta lock. It should also drop for DIRECTORY. Otherwise the second acl lookup returns the cached one (from VFS layer) which could be already stale. The problem we are seeing is that the acl changes on one node doesn't get refreshed on other nodes in the following case: Node 1 Node 2 -------------- ---------------- getfacl dir1 getfacl dir1 <-- this is OK setfacl -m u:user1:rwX dir1 getfacl dir1 <-- see the change for user1 getfacl dir1 <-- can't see change for user1 Link: https://lkml.kernel.org/r/20210903012631.6099-1-wen.gang.wang@oracle.com Signed-off-by: Wengang Wang Reviewed-by: Joseph Qi Cc: Mark Fasheh Cc: Joel Becker Cc: Junxiao Bi Cc: Changwei Ge Cc: Gang He Cc: Jun Piao Cc: Signed-off-by: Andrew Morton --- fs/ocfs2/dlmglue.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/fs/ocfs2/dlmglue.c~ocfs2-drop-acl-cache-for-directories-too +++ a/fs/ocfs2/dlmglue.c @@ -3951,7 +3951,7 @@ static int ocfs2_data_convert_worker(str oi = OCFS2_I(inode); oi->ip_dir_lock_gen++; mlog(0, "generation: %u\n", oi->ip_dir_lock_gen); - goto out; + goto out_forget; } if (!S_ISREG(inode->i_mode)) @@ -3982,6 +3982,7 @@ static int ocfs2_data_convert_worker(str filemap_fdatawait(mapping); } +out_forget: forget_all_cached_acls(inode); out: From patchwork Fri Sep 24 22:43:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 12516965 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 56587C433F5 for ; Fri, 24 Sep 2021 22:43:41 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 084E161265 for ; Fri, 24 Sep 2021 22:43:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 084E161265 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id A5BC96B007D; Fri, 24 Sep 2021 18:43:40 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A0B3C6B007E; Fri, 24 Sep 2021 18:43:40 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8FA0C6B0080; Fri, 24 Sep 2021 18:43:40 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0114.hostedemail.com [216.40.44.114]) by kanga.kvack.org (Postfix) with ESMTP id 7FFEE6B007D for ; Fri, 24 Sep 2021 18:43:40 -0400 (EDT) Received: from smtpin21.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 4FEE38249980 for ; Fri, 24 Sep 2021 22:43:40 +0000 (UTC) X-FDA: 78623945400.21.9F6A0A1 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf18.hostedemail.com (Postfix) with ESMTP id 0A9B14002088 for ; Fri, 24 Sep 2021 22:43:39 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id D71B56125F; Fri, 24 Sep 2021 22:43:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1632523419; bh=HzKdeZV8Mh/bu9P5zZcHBxV6NxADl9v994DHcueykNY=; h=Date:From:To:Subject:In-Reply-To:From; b=MWX/RQJjTsXaJg2nQuwitvKxWsdFPbywDyspDiKp6MrTzNpN60+4epTyMHP2N3JAj vqrU3dwo45XEtcowlexKCklvoUo2N0n3vaZICZUk0ckKLM4EoeMMnxuTOa7Dcn4aZN YGjhrXr5rKWOELuF2UhN+3O9OT6kxHCht6EB4kIs= Date: Fri, 24 Sep 2021 15:43:38 -0700 From: Andrew Morton To: akpm@linux-foundation.org, aou@eecs.berkeley.edu, jszhang@kernel.org, linux-mm@kvack.org, miles.chen@mediatek.com, mkubecek@suse.cz, mm-commits@vger.kernel.org, mmayer@broadcom.com, palmer@dabbelt.com, paul.walmsley@sifive.com, stefan.wahren@i2se.com, torvalds@linux-foundation.org Subject: [patch 07/16] scripts/sorttable: riscv: fix undeclared identifier 'EM_RISCV' error Message-ID: <20210924224338.8vuOlQPWr%akpm@linux-foundation.org> In-Reply-To: <20210924154257.1dbf6699ab8d88c0460f924f@linux-foundation.org> User-Agent: s-nail v14.8.16 X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 0A9B14002088 X-Stat-Signature: opxyht1pmac7qnetkmeyqrr4e74owryd Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b="MWX/RQJj"; dmarc=none; spf=pass (imf18.hostedemail.com: domain of akpm@linux-foundation.org designates 198.145.29.99 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org X-HE-Tag: 1632523419-63091 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: From: Miles Chen Subject: scripts/sorttable: riscv: fix undeclared identifier 'EM_RISCV' error Fix the following build break by adding a conditional definition of EM_RISCV in order to allow cross-compilation on machines which do not have EM_RISCV definition in their host. build break log from [1]: scripts/sorttable.c:352:7: error: use of undeclared identifier 'EM_RISCV' [1] https://lore.kernel.org/lkml/e8965b25-f15b-c7b4-748c-d207dda9c8e8@i2se.com/ EM_RISCV was added to in glibc 2.24 so builds on systems with glibc headers < 2.24 should show this error. [mkubecek@suse.cz: changelog addition] Link: https://lkml.kernel.org/r/20210913030625.4525-1-miles.chen@mediatek.com Fixes: 54fed35fd393 ("riscv: Enable BUILDTIME_TABLE_SORT") Signed-off-by: Miles Chen Reported-by: Stefan Wahren Tested-by: Stefan Wahren Reviewed-by: Jisheng Zhang Cc: Michal Kubecek Cc: Paul Walmsley Cc: Palmer Dabbelt Cc: Albert Ou Cc: Markus Mayer Signed-off-by: Andrew Morton --- scripts/sorttable.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/scripts/sorttable.c~scripts-sorttable-riscv-fix-undelcred-identifier-em_riscv-error +++ a/scripts/sorttable.c @@ -54,6 +54,10 @@ #define EM_ARCV2 195 #endif +#ifndef EM_RISCV +#define EM_RISCV 243 +#endif + static uint32_t (*r)(const uint32_t *); static uint16_t (*r2)(const uint16_t *); static uint64_t (*r8)(const uint64_t *); From patchwork Fri Sep 24 22:43:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 12516967 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 12E49C433FE for ; Fri, 24 Sep 2021 22:43:44 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id BDB2C61250 for ; Fri, 24 Sep 2021 22:43:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org BDB2C61250 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 6159D6B007E; Fri, 24 Sep 2021 18:43:43 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5C54A6B0080; Fri, 24 Sep 2021 18:43:43 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 48D7E900002; Fri, 24 Sep 2021 18:43:43 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0164.hostedemail.com [216.40.44.164]) by kanga.kvack.org (Postfix) with ESMTP id 349756B007E for ; Fri, 24 Sep 2021 18:43:43 -0400 (EDT) Received: from smtpin12.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 0090B181CCCB7 for ; Fri, 24 Sep 2021 22:43:42 +0000 (UTC) X-FDA: 78623945526.12.6E8C49D Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf15.hostedemail.com (Postfix) with ESMTP id B0FB2D000096 for ; Fri, 24 Sep 2021 22:43:42 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id CF1F861019; Fri, 24 Sep 2021 22:43:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1632523422; bh=RpB1DxDYaXU7/JZEGKGoFaw9n+Fbb+USJOf6il0Qr3A=; h=Date:From:To:Subject:In-Reply-To:From; b=xHMBBpXFLY7xyMFj5OiyOT6E6MbSzUxi6ijCNzbQD4PTCZDG6A2PGMpRETM8hhN8t cNHiv1CY3O6HO7sQy2MBsvzqZV8s/dPFe4Ae7tf7NejI9GSPEgx+1c3H+Q5OW+Yj2A I7pv5ZvCnKTG9f8s1X6k7fSFv+l442x5XFvXOKDU= Date: Fri, 24 Sep 2021 15:43:41 -0700 From: Andrew Morton To: akpm@linux-foundation.org, changbin.du@gmail.com, linux-mm@kvack.org, mm-commits@vger.kernel.org, torvalds@linux-foundation.org Subject: [patch 08/16] tools/vm/page-types: remove dependency on opt_file for idle page tracking Message-ID: <20210924224341.cP9xYOrED%akpm@linux-foundation.org> In-Reply-To: <20210924154257.1dbf6699ab8d88c0460f924f@linux-foundation.org> User-Agent: s-nail v14.8.16 X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: B0FB2D000096 X-Stat-Signature: 53h3gajm87sdm6sawctze6xd4yzq3hau Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=xHMBBpXF; spf=pass (imf15.hostedemail.com: domain of akpm@linux-foundation.org designates 198.145.29.99 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org; dmarc=none X-HE-Tag: 1632523422-717060 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: From: Changbin Du Subject: tools/vm/page-types: remove dependency on opt_file for idle page tracking Idle page tracking can also be used for process address space, not only file mappings. Without this change, using with '-i' option for process address space encounters below errors reported. $ sudo ./page-types -p $(pidof bash) -i mark page idle: Bad file descriptor mark page idle: Bad file descriptor mark page idle: Bad file descriptor mark page idle: Bad file descriptor mark page idle: Bad file descriptor mark page idle: Bad file descriptor .... Link: https://lkml.kernel.org/r/20210917032826.10669-1-changbin.du@gmail.com Signed-off-by: Changbin Du Signed-off-by: Andrew Morton --- tools/vm/page-types.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/tools/vm/page-types.c~tools-vm-page-types-remove-dependency-on-opt_file-for-idle-page-tracking +++ a/tools/vm/page-types.c @@ -1331,7 +1331,7 @@ int main(int argc, char *argv[]) if (opt_list && opt_list_mapcnt) kpagecount_fd = checked_open(PROC_KPAGECOUNT, O_RDONLY); - if (opt_mark_idle && opt_file) + if (opt_mark_idle) page_idle_fd = checked_open(SYS_KERNEL_MM_PAGE_IDLE, O_RDWR); if (opt_list && opt_pid) From patchwork Fri Sep 24 22:43:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 12516969 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 231C4C433FE for ; Fri, 24 Sep 2021 22:43:47 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id CDFDA6125F for ; Fri, 24 Sep 2021 22:43:46 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org CDFDA6125F Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 74F996B0080; Fri, 24 Sep 2021 18:43:46 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7005A6B0081; Fri, 24 Sep 2021 18:43:46 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 59EBF900002; Fri, 24 Sep 2021 18:43:46 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0127.hostedemail.com [216.40.44.127]) by kanga.kvack.org (Postfix) with ESMTP id 4B68B6B0080 for ; Fri, 24 Sep 2021 18:43:46 -0400 (EDT) Received: from smtpin28.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 13E828249980 for ; Fri, 24 Sep 2021 22:43:46 +0000 (UTC) X-FDA: 78623945652.28.A991C33 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf04.hostedemail.com (Postfix) with ESMTP id C37A050000A6 for ; Fri, 24 Sep 2021 22:43:45 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id A309B61250; Fri, 24 Sep 2021 22:43:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1632523425; bh=uNv4xnLVIZUJ/5ItL/wFdCYk4ilkW6Kp4YqRoqMTTNI=; h=Date:From:To:Subject:In-Reply-To:From; b=gLn0EsOMnyViv38LmBzD8fQ92lx/QTApgRbHls1MTZROiUGO4SQqvw3zkov8j1kCk ggXxQZ7+2jZq94wBYRNAwTDR3W14mM6M9fuU9omMbDy88qu5cas37Rl3ELBjM2QpS2 eO1E6ENMW1PRhaioGNFCrPY/lBtVM4L8nel93HuU= Date: Fri, 24 Sep 2021 15:43:44 -0700 From: Andrew Morton To: akpm@linux-foundation.org, benh@kernel.crashing.org, christophe.leroy@csgroup.eu, linux-mm@kvack.org, mm-commits@vger.kernel.org, mpe@ellerman.id.au, nathan@kernel.org, ndesaulniers@google.com, paulus@samba.org, pmenzel@molgen.mpg.de, thunder.leizhen@huawei.com, torvalds@linux-foundation.org Subject: [patch 09/16] lib/zlib_inflate/inffast: check config in C to avoid unused function warning Message-ID: <20210924224344.udphYXih4%akpm@linux-foundation.org> In-Reply-To: <20210924154257.1dbf6699ab8d88c0460f924f@linux-foundation.org> User-Agent: s-nail v14.8.16 Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=gLn0EsOM; spf=pass (imf04.hostedemail.com: domain of akpm@linux-foundation.org designates 198.145.29.99 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org; dmarc=none X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: C37A050000A6 X-Stat-Signature: g89uquxmp18tiz5c6w97bgrtwgtr59s7 X-HE-Tag: 1632523425-690094 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: From: Paul Menzel Subject: lib/zlib_inflate/inffast: check config in C to avoid unused function warning Building Linux for ppc64le with Ubuntu clang version 12.0.0-3ubuntu1~21.04.1 shows the warning below. arch/powerpc/boot/inffast.c:20:1: warning: unused function 'get_unaligned16' [-Wunused-function] get_unaligned16(const unsigned short *p) ^ 1 warning generated. Fix it, by moving the check from the preprocessor to C, so the compiler sees the use. Link: https://lkml.kernel.org/r/20210920084332.5752-1-pmenzel@molgen.mpg.de Signed-off-by: Paul Menzel Reviewed-by: Nathan Chancellor Tested-by: Nathan Chancellor Cc: Nick Desaulniers Cc: Christophe Leroy Cc: Zhen Lei Cc: Michael Ellerman Cc: Benjamin Herrenschmidt Cc: Paul Mackerras Signed-off-by: Andrew Morton --- lib/zlib_inflate/inffast.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) --- a/lib/zlib_inflate/inffast.c~lib-zlib_inflate-inffast-check-config-in-c-to-avoid-unused-function-warning +++ a/lib/zlib_inflate/inffast.c @@ -253,13 +253,12 @@ void inflate_fast(z_streamp strm, unsign sfrom = (unsigned short *)(from); loops = len >> 1; - do -#ifdef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS - *sout++ = *sfrom++; -#else - *sout++ = get_unaligned16(sfrom++); -#endif - while (--loops); + do { + if (IS_ENABLED(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS)) + *sout++ = *sfrom++; + else + *sout++ = get_unaligned16(sfrom++); + } while (--loops); out = (unsigned char *)sout; from = (unsigned char *)sfrom; } else { /* dist == 1 or dist == 2 */ From patchwork Fri Sep 24 22:43:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 12516971 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 248E9C433EF for ; Fri, 24 Sep 2021 22:43:50 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id CF1BD61265 for ; Fri, 24 Sep 2021 22:43:49 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org CF1BD61265 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 6B3F56B0081; Fri, 24 Sep 2021 18:43:49 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 662B4900002; Fri, 24 Sep 2021 18:43:49 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 529596B0083; Fri, 24 Sep 2021 18:43:49 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0033.hostedemail.com [216.40.44.33]) by kanga.kvack.org (Postfix) with ESMTP id 445E46B0081 for ; Fri, 24 Sep 2021 18:43:49 -0400 (EDT) Received: from smtpin25.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 11AA33A7AE for ; Fri, 24 Sep 2021 22:43:49 +0000 (UTC) X-FDA: 78623945778.25.D3D990B Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf13.hostedemail.com (Postfix) with ESMTP id B7A0C10302A6 for ; Fri, 24 Sep 2021 22:43:48 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id B3F6A61019; Fri, 24 Sep 2021 22:43:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1632523428; bh=s8P1CpLmLpRoOiPjzBm1G6HPo83QsQMj4HCrfGY5Yww=; h=Date:From:To:Subject:In-Reply-To:From; b=yJEBPSMHhJnZcTi4pGyG5/TNdeIrkkyetLS2t0WOJbZre+MX0wK/MY81Im7IPCAfY SoiyrSgrDfnyoRmQ2KymGUumbt+8SiAHTvmtLyktm1vGaYb8sNe0n9XHsfCCNw3Axm FiRIaFY5QpQ1RxiBw8Q7vjz8Ugu9OmmAlQsorQao= Date: Fri, 24 Sep 2021 15:43:47 -0700 From: Andrew Morton To: akpm@linux-foundation.org, cgoldswo@codeaurora.org, linux-mm@kvack.org, minchan@kernel.org, mm-commits@vger.kernel.org, oliver.sang@intel.com, torvalds@linux-foundation.org, zhengjun.xing@intel.com Subject: [patch 10/16] mm: fs: invalidate bh_lrus for only cold path Message-ID: <20210924224347.CvOV4Pt2c%akpm@linux-foundation.org> In-Reply-To: <20210924154257.1dbf6699ab8d88c0460f924f@linux-foundation.org> User-Agent: s-nail v14.8.16 X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: B7A0C10302A6 X-Stat-Signature: sh8jk1eaw76smuc4cati5896ofh4hegf Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=yJEBPSMH; dmarc=none; spf=pass (imf13.hostedemail.com: domain of akpm@linux-foundation.org designates 198.145.29.99 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org X-HE-Tag: 1632523428-336311 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: From: Minchan Kim Subject: mm: fs: invalidate bh_lrus for only cold path kernel test robot reported the regression of fio.write_iops[1] with [2]. Since lru_add_drain is called frequently, invalidate bh_lrus there could increase bh_lrus cache miss ratio, which needs more IO in the end. This patch moves the bh_lrus invalidation from the hot path( e.g., zap_page_range, pagevec_release) to cold path(i.e., lru_add_drain_all, lru_cache_disable). "Xing, Zhengjun" confirmed : I test the patch, the regression reduced to -2.9%. [1] https://lore.kernel.org/lkml/20210520083144.GD14190@xsang-OptiPlex-9020/ [2] 8cc621d2f45d, mm: fs: invalidate BH LRU during page migration Link: https://lkml.kernel.org/r/20210907212347.1977686-1-minchan@kernel.org Signed-off-by: Minchan Kim Reported-by: kernel test robot Reviewed-by: Chris Goldsworthy Tested-by: "Xing, Zhengjun" Signed-off-by: Andrew Morton --- fs/buffer.c | 8 ++++++-- include/linux/buffer_head.h | 4 ++-- mm/swap.c | 19 ++++++++++++++++--- 3 files changed, 24 insertions(+), 7 deletions(-) --- a/fs/buffer.c~mm-fs-invalidate-bh_lrus-for-only-cold-path +++ a/fs/buffer.c @@ -1425,12 +1425,16 @@ void invalidate_bh_lrus(void) } EXPORT_SYMBOL_GPL(invalidate_bh_lrus); -void invalidate_bh_lrus_cpu(int cpu) +/* + * It's called from workqueue context so we need a bh_lru_lock to close + * the race with preemption/irq. + */ +void invalidate_bh_lrus_cpu(void) { struct bh_lru *b; bh_lru_lock(); - b = per_cpu_ptr(&bh_lrus, cpu); + b = this_cpu_ptr(&bh_lrus); __invalidate_bh_lrus(b); bh_lru_unlock(); } --- a/include/linux/buffer_head.h~mm-fs-invalidate-bh_lrus-for-only-cold-path +++ a/include/linux/buffer_head.h @@ -194,7 +194,7 @@ void __breadahead_gfp(struct block_devic struct buffer_head *__bread_gfp(struct block_device *, sector_t block, unsigned size, gfp_t gfp); void invalidate_bh_lrus(void); -void invalidate_bh_lrus_cpu(int cpu); +void invalidate_bh_lrus_cpu(void); bool has_bh_in_lru(int cpu, void *dummy); struct buffer_head *alloc_buffer_head(gfp_t gfp_flags); void free_buffer_head(struct buffer_head * bh); @@ -408,7 +408,7 @@ static inline int inode_has_buffers(stru static inline void invalidate_inode_buffers(struct inode *inode) {} static inline int remove_inode_buffers(struct inode *inode) { return 1; } static inline int sync_mapping_buffers(struct address_space *mapping) { return 0; } -static inline void invalidate_bh_lrus_cpu(int cpu) {} +static inline void invalidate_bh_lrus_cpu(void) {} static inline bool has_bh_in_lru(int cpu, void *dummy) { return false; } #define buffer_heads_over_limit 0 --- a/mm/swap.c~mm-fs-invalidate-bh_lrus-for-only-cold-path +++ a/mm/swap.c @@ -620,7 +620,6 @@ void lru_add_drain_cpu(int cpu) pagevec_lru_move_fn(pvec, lru_lazyfree_fn); activate_page_drain(cpu); - invalidate_bh_lrus_cpu(cpu); } /** @@ -703,6 +702,20 @@ void lru_add_drain(void) local_unlock(&lru_pvecs.lock); } +/* + * It's called from per-cpu workqueue context in SMP case so + * lru_add_drain_cpu and invalidate_bh_lrus_cpu should run on + * the same cpu. It shouldn't be a problem in !SMP case since + * the core is only one and the locks will disable preemption. + */ +static void lru_add_and_bh_lrus_drain(void) +{ + local_lock(&lru_pvecs.lock); + lru_add_drain_cpu(smp_processor_id()); + local_unlock(&lru_pvecs.lock); + invalidate_bh_lrus_cpu(); +} + void lru_add_drain_cpu_zone(struct zone *zone) { local_lock(&lru_pvecs.lock); @@ -717,7 +730,7 @@ static DEFINE_PER_CPU(struct work_struct static void lru_add_drain_per_cpu(struct work_struct *dummy) { - lru_add_drain(); + lru_add_and_bh_lrus_drain(); } /* @@ -858,7 +871,7 @@ void lru_cache_disable(void) */ __lru_add_drain_all(true); #else - lru_add_drain(); + lru_add_and_bh_lrus_drain(); #endif } From patchwork Fri Sep 24 22:43:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 12516973 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A3A83C433FE for ; Fri, 24 Sep 2021 22:43:53 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 5536E61260 for ; Fri, 24 Sep 2021 22:43:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 5536E61260 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id EA2806B0082; Fri, 24 Sep 2021 18:43:52 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E52586B0083; Fri, 24 Sep 2021 18:43:52 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D22F46B0085; Fri, 24 Sep 2021 18:43:52 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0144.hostedemail.com [216.40.44.144]) by kanga.kvack.org (Postfix) with ESMTP id C34BE6B0082 for ; Fri, 24 Sep 2021 18:43:52 -0400 (EDT) Received: from smtpin04.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 770A23A7AE for ; Fri, 24 Sep 2021 22:43:52 +0000 (UTC) X-FDA: 78623945904.04.8DF747C Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf19.hostedemail.com (Postfix) with ESMTP id 3CAEBB0000A3 for ; Fri, 24 Sep 2021 22:43:52 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id DC50D6125F; Fri, 24 Sep 2021 22:43:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1632523431; bh=HCu43QJN8fFUzH4pAk1RQ0of9jxD2g34gKG0VdTvrhM=; h=Date:From:To:Subject:In-Reply-To:From; b=iYum7Ix/m2ny1WTeBnle6o3J3a4o0vmG1Q35VZplyKSwWuDwYWODHxebIaxSyPMzM hEhRiXILvtiIbJ0l3IvyfeA/RNkoE20UC918snJLXIyeaDqrewlsyzi9FlVGS7KQO4 5dduA5axwqbfr3qCXm2lWQfb65mcJwXNdrOoxoIs= Date: Fri, 24 Sep 2021 15:43:50 -0700 From: Andrew Morton To: akpm@linux-foundation.org, almasrymina@google.com, dave.hansen@linux.intel.com, jhubbard@nvidia.com, khandual@linux.vnet.ibm.com, linux-mm@kvack.org, mhocko@suse.com, minchan@kernel.org, mm-commits@vger.kernel.org, o451686892@gmail.com, osalvador@suse.de, pasha.tatashin@soleen.com, stable@vger.kernel.org, torvalds@linux-foundation.org, weixugc@google.com, willy@infradead.org, yang.shi@linux.alibaba.com, ying.huang@intel.com, ziy@nvidia.com Subject: [patch 11/16] mm/debug: sync up MR_CONTIG_RANGE and MR_LONGTERM_PIN Message-ID: <20210924224350.E8gKVdmtm%akpm@linux-foundation.org> In-Reply-To: <20210924154257.1dbf6699ab8d88c0460f924f@linux-foundation.org> User-Agent: s-nail v14.8.16 X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 3CAEBB0000A3 X-Stat-Signature: gdtxsdckx37ftymoyaispqbnyynoz7yr Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b="iYum7Ix/"; spf=pass (imf19.hostedemail.com: domain of akpm@linux-foundation.org designates 198.145.29.99 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org; dmarc=none X-HE-Tag: 1632523432-51926 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: From: Weizhao Ouyang Subject: mm/debug: sync up MR_CONTIG_RANGE and MR_LONGTERM_PIN Sync up MR_CONTIG_RANGE and MR_LONGTERM_PIN to migrate_reason_names. Link: https://lkml.kernel.org/r/20210921064553.293905-2-o451686892@gmail.com Fixes: 310253514bbf ("mm/migrate: rename migration reason MR_CMA to MR_CONTIG_RANGE") Fixes: d1e153fea2a8 ("mm/gup: migrate pinned pages out of movable zone") Signed-off-by: Weizhao Ouyang Reviewed-by: "Huang, Ying" Reviewed-by: John Hubbard Cc: Anshuman Khandual Cc: Michal Hocko Cc: Pavel Tatashin Cc: Yang Shi Cc: Zi Yan Cc: Dave Hansen Cc: Minchan Kim Cc: Mina Almasry Cc: "Matthew Wilcox (Oracle)" Cc: Oscar Salvador Cc: Wei Xu Cc: Signed-off-by: Andrew Morton --- mm/debug.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/mm/debug.c~mm-debug-sync-up-mr_contig_range-and-mr_longterm_pin +++ a/mm/debug.c @@ -24,7 +24,8 @@ const char *migrate_reason_names[MR_TYPE "syscall_or_cpuset", "mempolicy_mbind", "numa_misplaced", - "cma", + "contig_range", + "longterm_pin", }; const struct trace_print_flags pageflag_names[] = { From patchwork Fri Sep 24 22:43:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 12516975 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EC6FEC433EF for ; Fri, 24 Sep 2021 22:43:56 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 9D25261019 for ; Fri, 24 Sep 2021 22:43:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 9D25261019 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 441576B0083; Fri, 24 Sep 2021 18:43:56 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3F11B6B0085; Fri, 24 Sep 2021 18:43:56 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 26C896B0087; Fri, 24 Sep 2021 18:43:56 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0054.hostedemail.com [216.40.44.54]) by kanga.kvack.org (Postfix) with ESMTP id 169F86B0083 for ; Fri, 24 Sep 2021 18:43:56 -0400 (EDT) Received: from smtpin02.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id D12731813BCC7 for ; Fri, 24 Sep 2021 22:43:55 +0000 (UTC) X-FDA: 78623946030.02.A7A0D14 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf09.hostedemail.com (Postfix) with ESMTP id 891B73000100 for ; Fri, 24 Sep 2021 22:43:55 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id 4A7B361260; Fri, 24 Sep 2021 22:43:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1632523434; bh=sE8CPBkZHP3RfzSPxnIzjhaUGKIMli0dMYDYZte4y84=; h=Date:From:To:Subject:In-Reply-To:From; b=oKxee1FHUqdM0CFGqdMcIj7BjcDadvRbDBlMxyB8wJnLrRyj2vZej3fHh0Ra/nyMw nYgkli6nWq2OTuuJGl1aS2lx/c0ii5YRm5yxLwub3KxH2U4+iXNXfQuYbzaVKPHAOl S7JBP2DqYQwhAYwpuVCEL3d5h5b6/VPIcjHzSQ3s= Date: Fri, 24 Sep 2021 15:43:53 -0700 From: Andrew Morton To: akpm@linux-foundation.org, almasrymina@google.com, dave.hansen@linux.intel.com, jhubbard@nvidia.com, khandual@linux.vnet.ibm.com, linux-mm@kvack.org, mhocko@suse.com, minchan@kernel.org, mm-commits@vger.kernel.org, o451686892@gmail.com, osalvador@suse.de, pasha.tatashin@soleen.com, torvalds@linux-foundation.org, weixugc@google.com, willy@infradead.org, yang.shi@linux.alibaba.com, ying.huang@intel.com, ziy@nvidia.com Subject: [patch 12/16] mm/debug: sync up latest migrate_reason to migrate_reason_names Message-ID: <20210924224353.M5QtsjROk%akpm@linux-foundation.org> In-Reply-To: <20210924154257.1dbf6699ab8d88c0460f924f@linux-foundation.org> User-Agent: s-nail v14.8.16 X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 891B73000100 X-Stat-Signature: d6g3m3smiz7ei1o7itbpkpbs3m1r8d6e Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=oKxee1FH; dmarc=none; spf=pass (imf09.hostedemail.com: domain of akpm@linux-foundation.org designates 198.145.29.99 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org X-HE-Tag: 1632523435-128485 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: From: Weizhao Ouyang Subject: mm/debug: sync up latest migrate_reason to migrate_reason_names Sync up MR_DEMOTION to migrate_reason_names and add a synch prompt. Link: https://lkml.kernel.org/r/20210921064553.293905-3-o451686892@gmail.com Fixes: 26aa2d199d6f ("mm/migrate: demote pages during reclaim") Signed-off-by: Weizhao Ouyang Reviewed-by: "Huang, Ying" Reviewed-by: John Hubbard Cc: Anshuman Khandual Cc: Michal Hocko Cc: Pavel Tatashin Cc: Yang Shi Cc: Zi Yan Cc: Dave Hansen Cc: Minchan Kim Cc: Mina Almasry Cc: "Matthew Wilcox (Oracle)" Cc: Oscar Salvador Cc: Wei Xu Signed-off-by: Andrew Morton --- include/linux/migrate.h | 6 +++++- mm/debug.c | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) --- a/include/linux/migrate.h~mm-debug-sync-up-latest-migrate_reason-to-migrate_reason_names +++ a/include/linux/migrate.h @@ -19,6 +19,11 @@ struct migration_target_control; */ #define MIGRATEPAGE_SUCCESS 0 +/* + * Keep sync with: + * - macro MIGRATE_REASON in include/trace/events/migrate.h + * - migrate_reason_names[MR_TYPES] in mm/debug.c + */ enum migrate_reason { MR_COMPACTION, MR_MEMORY_FAILURE, @@ -32,7 +37,6 @@ enum migrate_reason { MR_TYPES }; -/* In mm/debug.c; also keep sync with include/trace/events/migrate.h */ extern const char *migrate_reason_names[MR_TYPES]; #ifdef CONFIG_MIGRATION --- a/mm/debug.c~mm-debug-sync-up-latest-migrate_reason-to-migrate_reason_names +++ a/mm/debug.c @@ -26,6 +26,7 @@ const char *migrate_reason_names[MR_TYPE "numa_misplaced", "contig_range", "longterm_pin", + "demotion", }; const struct trace_print_flags pageflag_names[] = { From patchwork Fri Sep 24 22:43:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 12516977 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F1030C433F5 for ; Fri, 24 Sep 2021 22:43:59 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id AB396610F7 for ; Fri, 24 Sep 2021 22:43:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org AB396610F7 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 57A326B0085; Fri, 24 Sep 2021 18:43:59 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5290C6B0087; Fri, 24 Sep 2021 18:43:59 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3C9796B0088; Fri, 24 Sep 2021 18:43:59 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0108.hostedemail.com [216.40.44.108]) by kanga.kvack.org (Postfix) with ESMTP id 2E1B66B0085 for ; Fri, 24 Sep 2021 18:43:59 -0400 (EDT) Received: from smtpin15.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id E574882499A8 for ; Fri, 24 Sep 2021 22:43:58 +0000 (UTC) X-FDA: 78623946156.15.C790332 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf26.hostedemail.com (Postfix) with ESMTP id 9F56320019C6 for ; Fri, 24 Sep 2021 22:43:58 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id 802CF61019; Fri, 24 Sep 2021 22:43:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1632523437; bh=3kBd8Jjyx3uP8qgInDqocUbp+J+zxapq3zaaVjVChcY=; h=Date:From:To:Subject:In-Reply-To:From; b=E4KAxqO6gYC6PB0+gbr3QajaBy5qHTVo6ljzA5fqcLODNcuZyz1xkOxPbxoKTZLwo W8Udwro9VhA6SGT+8GnDXM5g/OWRRzGkeHKl6jGob5l392k/33QSOwd3Dzi8tdtTsW l2Hy5qFaJoAj+zzqDcw68wsHDYo09D89XI0pCGXc= Date: Fri, 24 Sep 2021 15:43:57 -0700 From: Andrew Morton To: akpm@linux-foundation.org, aneesh.kumar@linux.ibm.com, dalias@libc.org, daniel@thingy.jp, geert+renesas@glider.be, jacopo+renesas@jmondi.org, linux-mm@kvack.org, mm-commits@vger.kernel.org, rob@landley.net, torvalds@linux-foundation.org, ysato@users.osdn.me Subject: [patch 13/16] sh: pgtable-3level: fix cast to pointer from integer of different size Message-ID: <20210924224357.vxbK4xVVa%akpm@linux-foundation.org> In-Reply-To: <20210924154257.1dbf6699ab8d88c0460f924f@linux-foundation.org> User-Agent: s-nail v14.8.16 X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 9F56320019C6 X-Stat-Signature: i7nemntsugztfm73mbaogsp556kooq55 Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=E4KAxqO6; dmarc=none; spf=pass (imf26.hostedemail.com: domain of akpm@linux-foundation.org designates 198.145.29.99 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org X-HE-Tag: 1632523438-699290 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: From: Geert Uytterhoeven Subject: sh: pgtable-3level: fix cast to pointer from integer of different size If X2TLB=y (CPU_SHX2=y or CPU_SHX3=y, e.g. migor_defconfig), pgd_t.pgd is "unsigned long long", causing: In file included from arch/sh/include/asm/pgtable.h:13, from include/linux/pgtable.h:6, from include/linux/mm.h:33, from arch/sh/kernel/asm-offsets.c:14: arch/sh/include/asm/pgtable-3level.h: In function `pud_pgtable': arch/sh/include/asm/pgtable-3level.h:37:9: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] 37 | return (pmd_t *)pud_val(pud); | ^ Fix this by adding an intermediate cast to "unsigned long", which is basically what the old code did before. Link: https://lkml.kernel.org/r/2c2eef3c9a2f57e5609100a4864715ccf253d30f.1631713483.git.geert+renesas@glider.be Fixes: 9cf6fa2458443118 ("mm: rename pud_page_vaddr to pud_pgtable and make it return pmd_t *") Signed-off-by: Geert Uytterhoeven Tested-by: Daniel Palmer Acked-by: Rob Landley Cc: Yoshinori Sato Cc: Rich Felker Cc: "Aneesh Kumar K . V" Cc: Jacopo Mondi Signed-off-by: Andrew Morton --- arch/sh/include/asm/pgtable-3level.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/arch/sh/include/asm/pgtable-3level.h~sh-pgtable-3level-fix-cast-to-pointer-from-integer-of-different-size +++ a/arch/sh/include/asm/pgtable-3level.h @@ -34,7 +34,7 @@ typedef struct { unsigned long long pmd; static inline pmd_t *pud_pgtable(pud_t pud) { - return (pmd_t *)pud_val(pud); + return (pmd_t *)(unsigned long)pud_val(pud); } /* only used by the stubbed out hugetlb gup code, should never be called */ From patchwork Fri Sep 24 22:44:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 12516979 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1AB69C433F5 for ; Fri, 24 Sep 2021 22:44:03 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id C19B561260 for ; Fri, 24 Sep 2021 22:44:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org C19B561260 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 6D82B6B0087; Fri, 24 Sep 2021 18:44:02 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6AF686B0088; Fri, 24 Sep 2021 18:44:02 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 59ECA6B0089; Fri, 24 Sep 2021 18:44:02 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0199.hostedemail.com [216.40.44.199]) by kanga.kvack.org (Postfix) with ESMTP id 4A87C6B0087 for ; Fri, 24 Sep 2021 18:44:02 -0400 (EDT) Received: from smtpin22.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 073003A7C0 for ; Fri, 24 Sep 2021 22:44:02 +0000 (UTC) X-FDA: 78623946324.22.AE70D04 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf04.hostedemail.com (Postfix) with ESMTP id B10C250000AD for ; Fri, 24 Sep 2021 22:44:01 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id A6EB461019; Fri, 24 Sep 2021 22:44:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1632523441; bh=Pw6rXTMhMM/nLK06bSzwqWYKfCa6ijh184dST5EsLzk=; h=Date:From:To:Subject:In-Reply-To:From; b=vdjw1TxXbj2MFWBECQRZWn/tNGN1O5rOtm5uttkUc/W5ms0xEmMvv1pl1RcQzDEm8 H1GsBxEMIL3hSZQvTvVvhVSk0qeUmvKYV7hGr+op+BESUL0vLpR8tsJKiCdqvGQBAq 9kKk1Dajg9zXNfv3o5Iq3TKY9y5/pNl4iDsLZb6Y= Date: Fri, 24 Sep 2021 15:44:00 -0700 From: Andrew Morton To: akpm@linux-foundation.org, andreyknvl@gmail.com, arnd@arndb.de, dvyukov@google.com, elver@google.com, glider@google.com, linux-mm@kvack.org, mm-commits@vger.kernel.org, nathan@kernel.org, ndesaulniers@google.com, ryabinin.a.a@gmail.com, torvalds@linux-foundation.org Subject: [patch 14/16] kasan: always respect CONFIG_KASAN_STACK Message-ID: <20210924224400.bnIuxajFt%akpm@linux-foundation.org> In-Reply-To: <20210924154257.1dbf6699ab8d88c0460f924f@linux-foundation.org> User-Agent: s-nail v14.8.16 X-Rspamd-Queue-Id: B10C250000AD X-Stat-Signature: d3e3g5xa6idq17fihwjtzzey9ai5r3qx Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=vdjw1TxX; spf=pass (imf04.hostedemail.com: domain of akpm@linux-foundation.org designates 198.145.29.99 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org; dmarc=none X-Rspamd-Server: rspam06 X-HE-Tag: 1632523441-140723 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: From: Nathan Chancellor Subject: kasan: always respect CONFIG_KASAN_STACK Currently, the asan-stack parameter is only passed along if CFLAGS_KASAN_SHADOW is not empty, which requires KASAN_SHADOW_OFFSET to be defined in Kconfig so that the value can be checked. In RISC-V's case, KASAN_SHADOW_OFFSET is not defined in Kconfig, which means that asan-stack does not get disabled with clang even when CONFIG_KASAN_STACK is disabled, resulting in large stack warnings with allmodconfig: drivers/video/fbdev/omap2/omapfb/displays/panel-lgphilips-lb035q02.c:117:12: error: stack frame size (14400) exceeds limit (2048) in function 'lb035q02_connect' [-Werror,-Wframe-larger-than] static int lb035q02_connect(struct omap_dss_device *dssdev) ^ 1 error generated. Ensure that the value of CONFIG_KASAN_STACK is always passed along to the compiler so that these warnings do not happen when CONFIG_KASAN_STACK is disabled. Link: https://github.com/ClangBuiltLinux/linux/issues/1453 References: 6baec880d7a5 ("kasan: turn off asan-stack for clang-8 and earlier") Link: https://lkml.kernel.org/r/20210922205525.570068-1-nathan@kernel.org Signed-off-by: Nathan Chancellor Reviewed-by: Marco Elver Cc: Andrey Ryabinin Cc: Alexander Potapenko Cc: Andrey Konovalov Cc: Dmitry Vyukov Cc: Nick Desaulniers Cc: Arnd Bergmann Signed-off-by: Andrew Morton --- scripts/Makefile.kasan | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/scripts/Makefile.kasan~kasan-always-respect-config_kasan_stack +++ a/scripts/Makefile.kasan @@ -33,10 +33,11 @@ else CFLAGS_KASAN := $(CFLAGS_KASAN_SHADOW) \ $(call cc-param,asan-globals=1) \ $(call cc-param,asan-instrumentation-with-call-threshold=$(call_threshold)) \ - $(call cc-param,asan-stack=$(stack_enable)) \ $(call cc-param,asan-instrument-allocas=1) endif +CFLAGS_KASAN += $(call cc-param,asan-stack=$(stack_enable)) + endif # CONFIG_KASAN_GENERIC ifdef CONFIG_KASAN_SW_TAGS From patchwork Fri Sep 24 22:44:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 12516981 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3CD07C433F5 for ; Fri, 24 Sep 2021 22:44:06 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id DFFF3610F7 for ; Fri, 24 Sep 2021 22:44:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org DFFF3610F7 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 839536B0071; Fri, 24 Sep 2021 18:44:05 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7EA036B0088; Fri, 24 Sep 2021 18:44:05 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6FF26900002; Fri, 24 Sep 2021 18:44:05 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0183.hostedemail.com [216.40.44.183]) by kanga.kvack.org (Postfix) with ESMTP id 61B666B0071 for ; Fri, 24 Sep 2021 18:44:05 -0400 (EDT) Received: from smtpin06.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 17E1039B1D for ; Fri, 24 Sep 2021 22:44:05 +0000 (UTC) X-FDA: 78623946450.06.E69D8DF Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf28.hostedemail.com (Postfix) with ESMTP id C7A87900009E for ; Fri, 24 Sep 2021 22:44:04 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id B8D9161250; Fri, 24 Sep 2021 22:44:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1632523444; bh=V8C691MMOp/rWW4+HTIKqi0ephg0nY4mpRWWs4qB8yU=; h=Date:From:To:Subject:In-Reply-To:From; b=t0pPPTwOGRfVJfY9ZeLSWafgvszfjIcAFXKPmMCCzkWppoQG2y4UQpT6I5B9SDHMy 6PG+IViX3Q5SWW/lgsS5pLzqwW1y/zxJTGYSW5IHNVo//1rHt04VObA3uQOHS9pEWk N73QTqP4J98M/Mh1JzxArVlJWKllh7H+VEy5SNMI= Date: Fri, 24 Sep 2021 15:44:03 -0700 From: Andrew Morton To: akpm@linux-foundation.org, david@redhat.com, linux-mm@kvack.org, mm-commits@vger.kernel.org, naoya.horiguchi@nec.com, songmuchun@bytedance.com, torvalds@linux-foundation.org, zhengqi.arch@bytedance.com Subject: [patch 15/16] mm/memory_failure: fix the missing pte_unmap() call Message-ID: <20210924224403.3ZN1b5z2V%akpm@linux-foundation.org> In-Reply-To: <20210924154257.1dbf6699ab8d88c0460f924f@linux-foundation.org> User-Agent: s-nail v14.8.16 X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: C7A87900009E X-Stat-Signature: 9ji6snxtz73zuz8g33q8s4hktkz6onu5 Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=t0pPPTwO; dmarc=none; spf=pass (imf28.hostedemail.com: domain of akpm@linux-foundation.org designates 198.145.29.99 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org X-HE-Tag: 1632523444-741393 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: From: Qi Zheng Subject: mm/memory_failure: fix the missing pte_unmap() call The paired pte_unmap() call is missing before the dev_pagemap_mapping_shift() returns. So fix it. Davidsaid "I guess this code never runs on 32bit / highmem, that's why we didn't notice so far". [akpm@linux-foundation.org: cleanup] Link: https://lkml.kernel.org/r/20210923122642.4999-1-zhengqi.arch@bytedance.com Signed-off-by: Qi Zheng Reviewed-by: David Hildenbrand Cc: Naoya Horiguchi Cc: Muchun Song Signed-off-by: Andrew Morton --- mm/memory-failure.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) --- a/mm/memory-failure.c~mm-memory_failure-fix-the-missing-pte_unmap-call +++ a/mm/memory-failure.c @@ -306,6 +306,7 @@ static unsigned long dev_pagemap_mapping struct vm_area_struct *vma) { unsigned long address = vma_address(page, vma); + unsigned long ret = 0; pgd_t *pgd; p4d_t *p4d; pud_t *pud; @@ -329,11 +330,10 @@ static unsigned long dev_pagemap_mapping if (pmd_devmap(*pmd)) return PMD_SHIFT; pte = pte_offset_map(pmd, address); - if (!pte_present(*pte)) - return 0; - if (pte_devmap(*pte)) - return PAGE_SHIFT; - return 0; + if (pte_present(*pte) && pte_devmap(*pte)) + ret = PAGE_SHIFT; + pte_unmap(pte); + return ret; } /* From patchwork Fri Sep 24 22:44:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 12516983 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 20C39C433EF for ; Fri, 24 Sep 2021 22:44:09 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id BFC4561019 for ; Fri, 24 Sep 2021 22:44:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org BFC4561019 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 6D8826B0088; Fri, 24 Sep 2021 18:44:08 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6881E6B0089; Fri, 24 Sep 2021 18:44:08 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 529DB900002; Fri, 24 Sep 2021 18:44:08 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0073.hostedemail.com [216.40.44.73]) by kanga.kvack.org (Postfix) with ESMTP id 445CA6B0088 for ; Fri, 24 Sep 2021 18:44:08 -0400 (EDT) Received: from smtpin08.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 02A64181EE402 for ; Fri, 24 Sep 2021 22:44:08 +0000 (UTC) X-FDA: 78623946576.08.5ED91A6 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf15.hostedemail.com (Postfix) with ESMTP id C19CCD000096 for ; Fri, 24 Sep 2021 22:44:07 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id BC446610F7; Fri, 24 Sep 2021 22:44:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1632523447; bh=/iXEJ0jhmXSVEgOcGxdKj/PT1MNs6Ql1OWiMFfWihQk=; h=Date:From:To:Subject:In-Reply-To:From; b=NYEcmriNinudufntzBrS4A2F5VPtudqbFdhwYlpi10T5eVfS3WojrM3pvohf1YLio Ue4hsXA26jcOAlO1LDmkA5eSNIa95vrGQOfipeQYR4Lhguia3a9dauDcVP84XZaGDZ ON/w9FimaHNFFG3yWV9sWh1dee+cppypZatCoN8w= Date: Fri, 24 Sep 2021 15:44:06 -0700 From: Andrew Morton To: akpm@linux-foundation.org, chenjun102@huawei.com, feng.tang@intel.com, linux-mm@kvack.org, mhocko@suse.com, mm-commits@vger.kernel.org, rui.xiang@huawei.com, stable@vger.kernel.org, torvalds@linux-foundation.org, wangkefeng.wang@huawei.com Subject: [patch 16/16] mm: fix uninitialized use in overcommit_policy_handler Message-ID: <20210924224406.83XR7wX9V%akpm@linux-foundation.org> In-Reply-To: <20210924154257.1dbf6699ab8d88c0460f924f@linux-foundation.org> User-Agent: s-nail v14.8.16 X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: C19CCD000096 X-Stat-Signature: a6y6j5fyhq73u13ue3wu57r4cdrs8i7e Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=NYEcmriN; spf=pass (imf15.hostedemail.com: domain of akpm@linux-foundation.org designates 198.145.29.99 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org; dmarc=none X-HE-Tag: 1632523447-522999 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: From: Chen Jun Subject: mm: fix uninitialized use in overcommit_policy_handler We get an unexpected value of /proc/sys/vm/overcommit_memory after running the following program: int main() { int fd = open("/proc/sys/vm/overcommit_memory", O_RDWR); write(fd, "1", 1); write(fd, "2", 1); close(fd); } write(fd, "2", 1) will pass *ppos = 1 to proc_dointvec_minmax. proc_dointvec_minmax will return 0 without setting new_policy. t.data = &new_policy; ret = proc_dointvec_minmax(&t, write, buffer, lenp, ppos) -->do_proc_dointvec -->__do_proc_dointvec if (write) { if (proc_first_pos_non_zero_ignore(ppos, table)) goto out; sysctl_overcommit_memory = new_policy; so sysctl_overcommit_memory will be set to an uninitialized value. Check whether new_policy has been changed by proc_dointvec_minmax. Link: https://lkml.kernel.org/r/20210923020524.13289-1-chenjun102@huawei.com Fixes: 56f3547bfa4d ("mm: adjust vm_committed_as_batch according to vm overcommit policy") Signed-off-by: Chen Jun Acked-by: Michal Hocko Reviewed-by: Feng Tang Reviewed-by: Kefeng Wang Cc: Rui Xiang Cc: Signed-off-by: Andrew Morton --- mm/util.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/mm/util.c~mm-fix-the-uninitialized-use-in-overcommit_policy_handler +++ a/mm/util.c @@ -787,7 +787,7 @@ int overcommit_policy_handler(struct ctl size_t *lenp, loff_t *ppos) { struct ctl_table t; - int new_policy; + int new_policy = -1; int ret; /* @@ -805,7 +805,7 @@ int overcommit_policy_handler(struct ctl t = *table; t.data = &new_policy; ret = proc_dointvec_minmax(&t, write, buffer, lenp, ppos); - if (ret) + if (ret || new_policy == -1) return ret; mm_compute_batch(new_policy);