Resguardo inicial

This commit is contained in:
lastdragon
2026-09-06 12:53:21 -06:00
parent 662efe3c2a
commit ad2088d178
94853 changed files with 43200404 additions and 0 deletions
@@ -0,0 +1,24 @@
@@ -50,6 +50,7 @@
struct list_head *a, struct list_head *b)
{
struct list_head *tail = head;
+ u8 count = 0;
for (;;) {
/* if equal, take 'a' -- important for sort stability */
@@ -75,6 +76,15 @@
/* Finish linking remainder of list b on to tail */
tail->next = b;
do {
+ /*
+ * If the merge is highly unbalanced (e.g. the input is
+ * already sorted), this loop may run many iterations.
+ * Continue callbacks to the client even though no
+ * element comparison is needed, so the client's cmp()
+ * routine can invoke cond_resched() periodically.
+ */
+ if (unlikely(!++count))
+ cmp(priv, b, b);
b->prev = tail;
tail = b;
b = b->next;