Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp7097072rdb; Fri, 15 Dec 2023 19:05:28 -0800 (PST) X-Google-Smtp-Source: AGHT+IGs8zDODhbkUzDiVHFrRpnOSMao5K+mGww55caKq1E+cTqhUvMGmN6fwmJQQCd1ZZa5jvUF X-Received: by 2002:a17:902:d509:b0:1d0:6ffd:e2c1 with SMTP id b9-20020a170902d50900b001d06ffde2c1mr14886400plg.91.1702695927864; Fri, 15 Dec 2023 19:05:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702695927; cv=none; d=google.com; s=arc-20160816; b=f7GyzIfLzZkWRWTUTsYj5TMFczn9BNPw5cglsvjPtkjeOv+IoaA7BJ4lzNGZFmiAeB RFe6FlWnD3kGmCgY5zRhBf4p/2ewRGSCpXWwE6FofE9TiQ5U7PYmXqh8q/VdcKaQDzQe Ffba9r5e8iyRV7SDgr+pgivu6r7ld2tYW5Xm2N3sCOk3F3PPaZ+e98FaGpQGWZJyXvz5 w78US68SnQfA3tS3EpcOYr8di6VJyMAiTdcKDF2G4kG1f+5PxaA7mVzpM+dDuH1yBKef qyxDTOE4TvtuqFYHN7kw+w3xcvy5hz3ut27EXea4vIvoQElhFIW7zI1tzhc4mAyxmPk6 nl2Q== 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-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-1978-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id p15-20020a170902e74f00b001d3970e60c5si765445plf.652.2023.12.15.19.05.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Dec 2023 19:05:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-1978-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::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-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-1978-linux.lists.archive=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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 878772825BE for ; Sat, 16 Dec 2023 03:05:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 10E4F1C32; Sat, 16 Dec 2023 03:05:22 +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 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT There is redundant code in __free_pages_ok(). Use free_one_page() simplify it. Signed-off-by: Yajun Deng --- 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); } -- 2.25.1