From patchwork Sat Dec 16 03:05:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yajun Deng X-Patchwork-Id: 179751 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:24d3:b0:fb:cd0c:d3e with SMTP id r19csp8991dyi; Fri, 15 Dec 2023 19:05:45 -0800 (PST) X-Google-Smtp-Source: AGHT+IG9ER1CoUsMfTmcOE99UjxQuwIc3sFe54ZPQhIUr7DLe/EXAvXRX1VcZ2d1uBb2q9d5yqjK X-Received: by 2002:a17:902:ebcd:b0:1d0:c906:f5e0 with SMTP id p13-20020a170902ebcd00b001d0c906f5e0mr15789448plg.72.1702695944822; Fri, 15 Dec 2023 19:05:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702695944; cv=none; d=google.com; s=arc-20160816; b=akZdbm/pHBgJPkh+eKACxCIMrQYkxhqXRqHljg32w/Y4dVxsLKpdBvTK42jelki5bs 8WVRkmNnJC7RZ0xBys0GWarLwuf4oGPcZMw0H3HtuK+8iBH+bA3M5vb5q9JAytvE/FRs FsS2xiq3KNHNs+K6Q+GvmMMCsLDsrKALEa4V9JBV+hsCa7ITJSPVMJLxVbHnB6a08hr1 7s4aCh3aw9ENRWcDBSYuRRLFrOtLfaLlb/eUR5MidgWPuTY/8H47HTjiCIE8zvmyNA14 f2ejNZkL2iiN6kMMbCeVTL9P6ayL3DI5vEXALSxw8kOD1NG6cqxqVrjOxoGtrM+1ZEVX lOsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=1jN0EDFNeQwt1P7nCWzZVthgRck6ZfeaXYZBtgJYnzA=; fh=KPJjYJHLC+uLVMTRQa7GdG2CYCH/otyIF0MYaE50dhE=; b=vB0azX993Y+0SgCRV7EP+wMyZMdjsR1q8Az27sSjmp8vp5rZTKagBMbiwXf+WAoRAb 925f/ZhJCRGaAG32EEAk3vsk4fxcxvpOs8/OMRfotAXGffZROA/+nhb6FRNZQI8pM8gh uRqiJGjROoi7BbvNFtOkK2kbCGomTNOKNAJXxFnieu1oMqXIyy8yHRy29SWq0llYhBFI aV4EOeTa+EYjY7SAI1j5e/jud2MEvNpeUB++N1yKNtVF3mjWTHh6pV2VNGy+39pyIGpL KdC9f3B1/bNJVUd7ziYeFigW7bFOeBrKYSkG+/pGj28B2L1uUNhRnk7bdh8oi2vylQ3Y 8g5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=Yhxt23ns; spf=pass (google.com: domain of linux-kernel+bounces-1978-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-1978-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id x12-20020a17090ab00c00b0028af0c2f56csi4935785pjq.110.2023.12.15.19.05.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Dec 2023 19:05:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-1978-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=Yhxt23ns; spf=pass (google.com: domain of linux-kernel+bounces-1978-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-1978-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id AD07CB20F08 for ; Sat, 16 Dec 2023 03:05:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 30EC74A26; Sat, 16 Dec 2023 03:05:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="Yhxt23ns" X-Original-To: linux-kernel@vger.kernel.org Received: from out-174.mta1.migadu.com (out-174.mta1.migadu.com [95.215.58.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4FEFF1846 for ; Sat, 16 Dec 2023 03:05:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1702695916; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=1jN0EDFNeQwt1P7nCWzZVthgRck6ZfeaXYZBtgJYnzA=; b=Yhxt23nsnltWoRJLnt6JKCI1vbfVo8Ui8sdV0GXbz6ZYu17OW1V8drLnRlF0Dgf175zcrQ I2Fs6yVnBDM2+Ybse72SfdDh25yu9271ynXdny8amaSMMQsgLAgkiZUcymIVZnIcxC38VX gEMoBvJ69tE6Ro6ECWCB9YR2u8UyFBE= From: Yajun Deng To: akpm@linux-foundation.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Yajun Deng Subject: [PATCH] mm: page_alloc: Simplify __free_pages_ok() Date: Sat, 16 Dec 2023 11:05:03 +0800 Message-Id: <20231216030503.2126130-1-yajun.deng@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785406103437539542 X-GMAIL-MSGID: 1785406103437539542 There is redundant code in __free_pages_ok(). Use free_one_page() simplify it. Signed-off-by: Yajun Deng Reviewed-by: Matthew Wilcox (Oracle) --- mm/page_alloc.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 2f646773a934..f46af8616cac 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -1262,7 +1262,6 @@ static void free_one_page(struct zone *zone, static void __free_pages_ok(struct page *page, unsigned int order, fpi_t fpi_flags) { - unsigned long flags; int migratetype; unsigned long pfn = page_to_pfn(page); struct zone *zone = page_zone(page); @@ -1277,13 +1276,7 @@ static void __free_pages_ok(struct page *page, unsigned int order, */ migratetype = get_pfnblock_migratetype(page, pfn); - spin_lock_irqsave(&zone->lock, flags); - if (unlikely(has_isolate_pageblock(zone) || - is_migrate_isolate(migratetype))) { - migratetype = get_pfnblock_migratetype(page, pfn); - } - __free_one_page(page, pfn, zone, order, migratetype, fpi_flags); - spin_unlock_irqrestore(&zone->lock, flags); + free_one_page(zone, page, pfn, order, migratetype, fpi_flags); __count_vm_events(PGFREE, 1 << order); }