Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp560604imm; Thu, 13 Sep 2018 04:22:51 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZ8xNOK0aiG/KfZShCsCTqijDJaaWXW+sikm0O8PfykVSUN9x7BQBgJ7P/QgEZNZfZKwbms X-Received: by 2002:a63:77ce:: with SMTP id s197-v6mr6838057pgc.172.1536837771268; Thu, 13 Sep 2018 04:22:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536837771; cv=none; d=google.com; s=arc-20160816; b=WYOpxwbx/UF8HiJSkzYZBWpNJSJK0RUiQpL15KingGRCklShbTYTnsCpz5OFKooaM0 Wg0U50US854CZQbmcW7PiQrd2lJdBGs6cKQVQwckoMyKaWLBDd9bIbYNL4LBLk7ZgFWX gJTJlt5OIfOw7yLkcaZQLPDy6MgAJCnr8cnTc7ED7g2HIsBaSEHdEQisEsFJRUfTXp9W lZbTSryQAeeE/RDmwutvPAtke2Eoha3jGKKL6mI00ZBbP8QoLsqyAlqdbOn93rrKaWAh jS40t6dBXdKZ5UlOPQ3DWLVvkdZIrimNcd8RDwNldUPYI328HtJ6iT8Vze6pxu07Rojz OCTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:to:from:dkim-signature; bh=6IAsQA6hU2nCPGIGOd69vr3u1tuP9372Dtj3Q9Neyds=; b=ITphSRolcdWmAxrG+NYPoAh2dYYp3UwDRyyeBF7TligmYWMSVXhBZ12EcytUXnAYUs 9drUK0D+Le7FuZUR9xCuU23G4ZO6BSH4FuvGv1M+KnRO6WWZic1zedF7fXBChqvjiOS6 s+8p2aHOA4g3mnJ8U7m+x+Q7Bo9GO9hvrrKm3YZgqikrNHPh4HHCsei261zgb/SMn+/t ue/2Ia2d7M8ftz0vbQg3UlwDPdKMLnXIuP8eR3Qr5hiU7o8spyJ/Jy63VaPUstztgCJg hKfomERt1uGR14Va38K6+8TcclGqd7OP+6p+bRY1aTXVUJGi844BaO4n2L14HncTsK21 eYxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=lOzJGeri; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y28-v6si4010955pga.485.2018.09.13.04.22.35; Thu, 13 Sep 2018 04:22:51 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=lOzJGeri; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727002AbeIMQbM (ORCPT + 99 others); Thu, 13 Sep 2018 12:31:12 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:37299 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726797AbeIMQbL (ORCPT ); Thu, 13 Sep 2018 12:31:11 -0400 Received: by mail-wm0-f68.google.com with SMTP id n11-v6so5791251wmc.2 for ; Thu, 13 Sep 2018 04:22:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=6IAsQA6hU2nCPGIGOd69vr3u1tuP9372Dtj3Q9Neyds=; b=lOzJGeri27oyM5PSoVkMpY+8m2bGZb4UTObAFthyIe2/AC1Fl4pn5iGVRDvW1ne8Hp qY3LSFujH9+BZbWfkhDVpMOpmPZPHlgu3eHHtBNCajX/34IFfMlmshq7YYGq4ffJJcsq uiDhlkXK3WUUZ2Y2EaTH+8+r+2fd/0YGWXncjIExsBo+r4dqN2nCG0g1RhorMHvSQoSu dCwQoTrydg1zl6Lst7/jwr+08KUPj2qPpZwt6Um1eo2zJDhgjD6oO/TJCPyUYsMmWTQB hC4lH1Z4mhZLHRMS2fdjAOvCDdoYu0ii1hj1cznGfHj/2pq9OHfpnAymQEZAP/LKOHaG Bg8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=6IAsQA6hU2nCPGIGOd69vr3u1tuP9372Dtj3Q9Neyds=; b=AyxLnyzB7lUc7MzWB88q8of3SQ2P/QS+tAkVLfi7sQCcS4/qP9iZpjVfKDLDY3uMsG m7HP5jMGBjb5zgGN1th4AuZDw9VD9jQf5lrL3pFJHlnbGwXg0hxkAaY7Z36qBTux/8E+ f6lzVtIVguJt6Wcyi7LdSaUV+UtTH85Pmu+4g0B8m6/grEfGb87BOJQnWIHuFY0nPtto Cd4taciKkWakWn6ytxGlMOf3tIG4MSi3ZWJmbXb//FE2z5pUIhb1Gsw32EAH1SrXCpss WUaNcsFGi7MmRkCEsX68gkw+RWqyurWSPbXTp/ps9WdDIUfDuNOnLX95fEhGVPCdgHjZ d/nA== X-Gm-Message-State: APzg51CgDcsJesw4W6mKcPhD4fPkQ3M9JrbIWL1y+6fC7dDxqvvJA+w3 OviaOD5Ltsia7g21nP3SBqrViS9R X-Received: by 2002:a1c:32c4:: with SMTP id y187-v6mr5019300wmy.31.1536837729613; Thu, 13 Sep 2018 04:22:09 -0700 (PDT) Received: from baker.fritz.box ([2a02:908:1257:4460:c8f7:2479:525e:9500]) by smtp.gmail.com with ESMTPSA id u65-v6sm5528748wmd.31.2018.09.13.04.22.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 13 Sep 2018 04:22:09 -0700 (PDT) From: "=?UTF-8?q?Christian=20K=C3=B6nig?=" X-Google-Original-From: =?UTF-8?q?Christian=20K=C3=B6nig?= To: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/2] list: introduce list_bulk_move_tail helper Date: Thu, 13 Sep 2018 13:22:07 +0200 Message-Id: <20180913112208.1353-1-christian.koenig@amd.com> X-Mailer: git-send-email 2.14.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Move all entries between @first and including @last before @head. This is useful for LRU lists where a whole block of entries should be moved to the end of an list. Signed-off-by: Christian König --- include/linux/list.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/include/linux/list.h b/include/linux/list.h index de04cc5ed536..edb7628e46ed 100644 --- a/include/linux/list.h +++ b/include/linux/list.h @@ -183,6 +183,29 @@ static inline void list_move_tail(struct list_head *list, list_add_tail(list, head); } +/** + * list_bulk_move_tail - move a subsection of a list to its tail + * @head: the head that will follow our entry + * @first: first entry to move + * @last: last entry to move, can be the same as first + * + * Move all entries between @first and including @last before @head. + * All three entries must belong to the same linked list. + */ +static inline void list_bulk_move_tail(struct list_head *head, + struct list_head *first, + struct list_head *last) +{ + first->prev->next = last->next; + last->next->prev = first->prev; + + head->prev->next = first; + first->prev = head->prev; + + last->next = head; + head->prev = last; +} + /** * list_is_last - tests whether @list is the last entry in list @head * @list: the entry to test -- 2.14.1