From patchwork Mon Oct 4 14:28:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Uladzislau Rezki X-Patchwork-Id: 12534133 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 0DED3C433FE for ; Mon, 4 Oct 2021 14:28:48 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id AF10061251 for ; Mon, 4 Oct 2021 14:28:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org AF10061251 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 3BE2A940038; Mon, 4 Oct 2021 10:28:47 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 36B6A94000B; Mon, 4 Oct 2021 10:28:47 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 149EA940038; Mon, 4 Oct 2021 10:28:47 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0121.hostedemail.com [216.40.44.121]) by kanga.kvack.org (Postfix) with ESMTP id DED3294000B for ; Mon, 4 Oct 2021 10:28:46 -0400 (EDT) Received: from smtpin16.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 9E1472CBDA for ; Mon, 4 Oct 2021 14:28:46 +0000 (UTC) X-FDA: 78658986252.16.85BF837 Received: from mail-lf1-f47.google.com (mail-lf1-f47.google.com [209.85.167.47]) by imf27.hostedemail.com (Postfix) with ESMTP id 52F887001F4E for ; Mon, 4 Oct 2021 14:28:46 +0000 (UTC) Received: by mail-lf1-f47.google.com with SMTP id e15so72464231lfr.10 for ; Mon, 04 Oct 2021 07:28:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=0LHatFhVEIqMlI2Msj/gKIKEeT6D+78N3ryw0xfIhf4=; b=QGO/ulsvPQ98gRMYF3sIRAWyWai5o4ioiYmqDqdO0Wt81Wjn9/ddpCKpzIjdljWaVx ycGTegDq5EcpJGQToHEUIz8KOxgT4AZCembfMm9K5iGsjsnvAXCFmJ7bgG6BIURWIj6N DcB0vMhIbyUzmGvOUtTV4zkcje83glJbCMWnS+fmuYrkOz9rUlPBsXuttCfV2bd18AUe K7l43++pjUB+vlfDhLJ+9qb8BYAeb+n156MFLmjbnGyCapzhGHGlzJPpFOsAYcPF1/nf PY+v/abcCvFxtd8h4MEbVm96tBsrEdf2cpqQrmEKZ3vIoocRTznyKxOlBKRu4lKhv/i3 Jucw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=0LHatFhVEIqMlI2Msj/gKIKEeT6D+78N3ryw0xfIhf4=; b=vGAq18UnstBTOOBX2BJRX6nfx9PExKakD/aK2kPW8Ann/xV+4pQzo5uOsxl/XPOjPm 6cvyGRfvtHbat5O35MEFz6ir3CEAbcw5p705Hi00GGfV9N26t5aQtpfDqmkuubQtsLGE J2Kcu/Ezf4FVOFjSFm40EeJ2ilXyUaX3dA8n95clo0IK3igKCpTTzhckOB9ihub1Ahpv NX/z/FjzDJe9uT1bmDnyk6stVu8Fwoi4al8R3FBSMd2X94desfsr3edE+ahpCNe72Xso y1sG6BzC849m76hg/QV53LtIjXvRzRQNyOyPve/fLhAEGeMk4KsLl5D549e26NvSqzSW 9dKQ== X-Gm-Message-State: AOAM533BzB81GY6Lfy1in43aHIRp9xV5KyOSlvtHN3qeITDqwp/eJxpT PKqEEcwJFTGIY1NqmRNJoMY= X-Google-Smtp-Source: ABdhPJzNPnvc1CO4IOvFyX1d4m2ON2hLZB/7CiFpBal3s8jAdqO42Mg2HEVq4rjm84SPVvj56OxmLQ== X-Received: by 2002:a05:6512:3082:: with SMTP id z2mr14905907lfd.657.1633357724143; Mon, 04 Oct 2021 07:28:44 -0700 (PDT) Received: from pc638.lan (h5ef52e3d.seluork.dyn.perspektivbredband.net. [94.245.46.61]) by smtp.gmail.com with ESMTPSA id x15sm1338299lfe.129.2021.10.04.07.28.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Oct 2021 07:28:43 -0700 (PDT) From: "Uladzislau Rezki (Sony)" To: Andrew Morton Cc: linux-mm@kvack.org, LKML , Mel Gorman , Christoph Hellwig , Matthew Wilcox , Nicholas Piggin , Uladzislau Rezki , Hillf Danton , Michal Hocko , Oleksiy Avramchenko , Steven Rostedt Subject: [PATCH 2/2] mm/vmalloc: Check various alignments when debugging Date: Mon, 4 Oct 2021 16:28:29 +0200 Message-Id: <20211004142829.22222-2-urezki@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20211004142829.22222-1-urezki@gmail.com> References: <20211004142829.22222-1-urezki@gmail.com> MIME-Version: 1.0 X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 52F887001F4E X-Stat-Signature: egrampubincff6iens55xqm19y1ieb4a Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b="QGO/ulsv"; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf27.hostedemail.com: domain of urezki@gmail.com designates 209.85.167.47 as permitted sender) smtp.mailfrom=urezki@gmail.com X-HE-Tag: 1633357726-25974 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: Before we did not guarantee a free block with lowest start address for allocations with alignment >= PAGE_SIZE. Because an alignment overhead was included into a search length like below: length = size + align - 1; doing so we make sure that a bigger block would fit after applying an alignment adjustment. Now there is no such limitation, i.e. any alignment that user wants to apply will result to a lowest address of returned free area. Signed-off-by: Uladzislau Rezki (Sony) --- mm/vmalloc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mm/vmalloc.c b/mm/vmalloc.c index 9cce45dbdee0..343cb5d40706 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c @@ -1269,7 +1269,7 @@ find_vmap_lowest_linear_match(unsigned long size, } static void -find_vmap_lowest_match_check(unsigned long size) +find_vmap_lowest_match_check(unsigned long size, unsigned long align) { struct vmap_area *va_1, *va_2; unsigned long vstart; @@ -1278,8 +1278,8 @@ find_vmap_lowest_match_check(unsigned long size) get_random_bytes(&rnd, sizeof(rnd)); vstart = VMALLOC_START + rnd; - va_1 = find_vmap_lowest_match(size, 1, vstart); - va_2 = find_vmap_lowest_linear_match(size, 1, vstart); + va_1 = find_vmap_lowest_match(size, align, vstart); + va_2 = find_vmap_lowest_linear_match(size, align, vstart); if (va_1 != va_2) pr_emerg("not lowest: t: 0x%p, l: 0x%p, v: 0x%lx\n", @@ -1458,7 +1458,7 @@ __alloc_vmap_area(unsigned long size, unsigned long align, return vend; #if DEBUG_AUGMENT_LOWEST_MATCH_CHECK - find_vmap_lowest_match_check(size); + find_vmap_lowest_match_check(size, align); #endif return nva_start_addr;